File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -4,22 +4,22 @@ def threeSum(self, nums: list[int]) -> list[list[int]]:
4
4
n = len (nums )
5
5
returnList = []
6
6
for i , i_num in enumerate (nums ):
7
- if i and i_num == nums [i - 1 ]:
7
+ if i and i_num == nums [i - 1 ]:
8
8
continue
9
- l = i + 1
10
- r = n - 1
11
- while l < r :
12
- sum = i_num + nums [l ] + nums [r ]
9
+ left = i + 1
10
+ right = n - 1
11
+ while left < right :
12
+ sum = i_num + nums [left ] + nums [right ]
13
13
if sum == 0 :
14
- returnList .append ([i_num , nums [l ], nums [r ]])
15
- while l < r and nums [l ] == nums [l + 1 ]:
16
- l += 1
17
- while l < r and nums [r ] == nums [r - 1 ]:
18
- r -= 1
19
- l += 1
20
- r -= 1
14
+ returnList .append ([i_num , nums [left ], nums [right ]])
15
+ while left < right and nums [left ] == nums [left + 1 ]:
16
+ left += 1
17
+ while left < right and nums [right ] == nums [right - 1 ]:
18
+ right -= 1
19
+ left += 1
20
+ right -= 1
21
21
elif sum < 0 :
22
- l += 1
22
+ left += 1
23
23
else :
24
- r -= 1
24
+ right -= 1
25
25
return returnList
You can’t perform that action at this time.
0 commit comments