Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain duplicate triplets.
Asked at 42 companies
AdobeAkuna CapitalAlibaba
Hints
1.Think about what data structure fits 3Sum
2.Consider the brute force complexity and how to optimize