We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9fb7298 commit da09b2dCopy full SHA for da09b2d
LeetCode/41.first-missing-positive.cpp
@@ -5,7 +5,7 @@ class Solution {
5
{
6
int n = A.size();
7
for(int i = 0; i < n; ++ i) {
8
- while(A[i] >= 1 && A[i] <= n && A[i] != i+1)
+ while(A[i] >= 1 && A[i] <= n && A[i] != A[A[i]-1])
9
swap(A[i], A[A[i] - 1]);
10
}
11
0 commit comments