Skip to content

Commit 4c6f2d8

Browse files
authored
Update find-sorted-submatrices-with-maximum-element-at-most-k.py
1 parent 8a94bd5 commit 4c6f2d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Python/find-sorted-submatrices-with-maximum-element-at-most-k.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def count(heights):
1313
result = curr = 0
1414
stk = []
1515
for i in xrange(len(heights)):
16-
while stk and heights[stk[-1]] > heights[i]:
16+
while stk and heights[stk[-1]] >= heights[i]:
1717
j = stk.pop()
1818
curr -= (heights[j]-heights[i])*(j-(stk[-1] if stk else -1))
1919
stk.append(i)

0 commit comments

Comments
 (0)