Skip to content

Commit

Permalink
Merge pull request #128 from omengye/patch-1
Browse files Browse the repository at this point in the history
array index out of bounds, fix to low<n-1
  • Loading branch information
haoel committed Jan 2, 2017
2 parents 0941073 + 879e9e6 commit b0507b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion algorithms/cpp/3Sum/3Sum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ vector<vector<int> > threeSum(vector<int> &num) {
high--;
} else{
//skip the duplication
while(low<n && num[low]==num[low+1]) low++;
while(low<n-1 && num[low]==num[low+1]) low++;
low++;
}
}
Expand Down

0 comments on commit b0507b1

Please sign in to comment.