-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path15.cpp
More file actions
30 lines (25 loc) · 725 Bytes
/
Copy path15.cpp
File metadata and controls
30 lines (25 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <vector>
using namespace std;
class Solution {
public:
vector< vector<int> > threeSum(vector<int>& nums) {
vector< vector<int> > vRet;
for(int i = 0; i < nums.size(); ++i)
for(int j = i + 1; j < nums.size(); ++j)
for(int k = j + 1; k < nums.size(); ++k)
{
if(nums[i] + nums[j] + nums[k] == 0)
{
vector<int> vTmp;
vTmp.push_back(nums[i]);
vTmp.push_back(nums[j]);
vTmp.push_back(nums[k]);
vRet.push_back(vTmp);
}
}
}
};
int main()
{
return 0;
}