#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<vector<int>> threeSum(vector<int>& nums) {
// TODO: find all unique triplets that sum to zero
return {};
}
int main() {
vector<int> nums = {-1, 0, 1, 2, -1, -4};
auto result = threeSum(nums);
for (auto& t : result) {
cout << "[" << t[0] << ", " << t[1] << ", " << t[2] << "]
";
}
return 0;
}
Click Run to execute, or Submit to grade (all languages).