algorithm · Level 2 · 25 min
Given an integer array nums, return all triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, j != k, and nums[i] + nums[j] + nums[k] == 0. Solution set must not contain duplicate triplets.
nums (array of integers).- `3 <= nums.length <= 3000` - `-10^5 <= nums[i] <= 10^5`
Return array of triplets (each triplet is an array of three numbers).