Created
February 12, 2022 08:07
-
-
Save amarjitdhillon/783bf3335248e5641832aea1506fbcd8 to your computer and use it in GitHub Desktop.
Range Addition II
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
def maxCount(self, m: int, n: int, ops: List[List[int]]) -> int: | |
for r,c in ops: | |
# expand and shrink the matrix size (bottom-right boundry of matrix) based on the current operation | |
m = min(m,r) | |
n = min(c,n) | |
# total number of elements will be multiplication of bottom and right boundry asssming left and top boundry is 0,0 | |
return m*n | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment