Skip to content

Commit

Permalink
array index out of bounds, fix to low<n-1
Browse files Browse the repository at this point in the history
  • Loading branch information
omengye authored Dec 26, 2016
1 parent 48715af commit 3ad9d08
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 3ad9d08

Please sign in to comment.