Skip to content

Commit c68ee0c

Browse files
author
yangdi
committed
refactor 3Sum.py
1 parent 892f849 commit c68ee0c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src2/3Sum/3Sum.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def threeSum(self, num):
4141
continue
4242

4343
# j step backward
44-
for j in range(i + 1, numLen):
45-
j = numLen + i - j
44+
for j in reversed(range(i + 1, numLen)):
4645
if j + 1 != numLen and num[j] == num[j+1]:
4746
continue
4847

0 commit comments

Comments
 (0)