Skip to content

Commit da09b2d

Browse files
authored
bugfix
1 parent 9fb7298 commit da09b2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

LeetCode/41.first-missing-positive.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Solution {
55
{
66
int n = A.size();
77
for(int i = 0; i < n; ++ i) {
8-
while(A[i] >= 1 && A[i] <= n && A[i] != i+1)
8+
while(A[i] >= 1 && A[i] <= n && A[i] != A[A[i]-1])
99
swap(A[i], A[A[i] - 1]);
1010
}
1111

0 commit comments

Comments
 (0)