input: Write a python function to find all unique triplets in the array which gives the sum of zero.
  assert threeSum([-1, 0, 1, 2, -1, -4]) == [[-1, -1, 2], [-1, 0, 1]]
  assert threeSum([0, 0, 0, 0]) == [[0, 0, 0]]
  assert threeSum([3, -2, 1, 0, -1, 2]) == [[-2, -1, 3], [-2, 0, 2], [-1, 0, 1]]
  assert threeSum([-4, -2, -1, 0, 1, 2, 3]) == [[-4, 1, 3], [-2, -1, 3], [-2, 0, 2], [-1, 0, 1]]
output: def threeSum(nums):
      nums.sort()
      res = []
      n = len(nums)
      for i in range(n - 2):
          if i > 0 and nums[i] == nums[i - 1]:
              continue
          left, right = i + 1, n - 1
          while left < right:
              s = nums[i] + nums[left] + nums[right]
              if s < 0:
                  left += 1
              elif s > 0:
                  right -= 1
              else:
                  res.append([nums[i], nums[left], nums[right]])
                  while left < right and nums[left == nums[left + 1]]:
                      left += 1
                  while left < right and nums[right] == nums[right - 1]:
                      right -= 1
                  left += 1
                  right -= 1
      return res