Skip to content

Commit

Permalink
Update 1292.Maximum-Side-Length-of-a-Square-with-Sum-Less-than-or-Equ…
Browse files Browse the repository at this point in the history
…al-to-Threshold.cpp
  • Loading branch information
wisdompeak authored Apr 13, 2022
1 parent e41a5ac commit 25981a6
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Solution {
for (int j=1; j<=n; j++)
presum[i][j] = presum[i-1][j]+presum[i][j-1]-presum[i-1][j-1]+mat[i-1][j-1];

int left = 1, right = min(m,n);
int left = 0, right = min(m,n);
while (left < right)
{
int mid = right-(right-left)/2;
Expand All @@ -24,8 +24,7 @@ class Solution {
else
right = mid-1;
}
if (isOK(left, threshold)) return left;
else return 0;
return left;
}

bool isOK(int len, int threshold)
Expand Down

0 comments on commit 25981a6

Please sign in to comment.