Skip to content

Commit

Permalink
209 bug fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyubobobo committed May 23, 2019
1 parent b46d56d commit 4418093
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 0209-Minimum-Size-Subarray-Sum/cpp-0209/main3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Solution {
sums[i] = sums[i-1] + nums[i-1];

int res = nums.size() + 1;
for(int l = 0 ; l < (int)nums.size() - 1 ; l ++){
for(int l = 0; l < (int)nums.size(); l ++){
auto r_bound = lower_bound(sums.begin(), sums.end(), sums[l] + s);
if(r_bound != sums.end()){
int r = r_bound - sums.begin();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public int minSubArrayLen(int s, int[] nums) {
sums[i] = sums[i-1] + nums[i-1];

int res = nums.length + 1;
for(int l = 0 ; l < nums.length - 1 ; l ++){
for(int l = 0 ; l < nums.length; l ++){
// Unfortunately, there's no lowerBound method in Java,
// We need to implement our own lowerBound :(
int r = lowerBound(sums, sums[l] + s);
Expand Down

0 comments on commit 4418093

Please sign in to comment.