title: My code is giving a different out put for leetcode 3sum problem. Can anyone correct my code?
body: <p>I am trying to solve Leetcode problem '3sum'.</p>
  <p>Here is the question:
  Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
  Notice that the solution set must not contain duplicate triplets.</p>
  <p>Example:</p>
  <p>Input: <code>nums = [-1,0,1,2,-1,-4]</code></p>
  <p>Output: <code>[[-1,-1,2],[-1,0,1]]</code></p>
  <p>Here is my code and output.</p>
  <pre><code>class Solution:
  
      def threeSum(self, nums: List[int]) -&gt; List[List[int]]:
          
          result = []
          nums.sort()
                        
          for i in range(len(nums)):       
              if nums[i] &gt; 0: 
                  break
              if i == 0 or nums[i] != nums[i-1]:
                  continue
  
              left, right = i+1, len(nums)-1
  
              while left &lt; right:
                  prod = nums[i]+nums[left]+nums[right]                
                  if prod &gt; 0:    
                      right -= 1
                  elif prod &lt; 0:   
                      left += 1
                  else:            
                      result.append([nums[i],nums[right],nums[left]])
                      
                      left += 1
                      right-= 1
                      while left &lt; right and nums[left] == nums[left-1]:
                          left += 1
                  
          return result
  </code></pre>
  <p>Can any one guide me what's wrong with my code?</p>