python code beats 100%


  • 0
    Y

    class Solution(object):
    def maxCount(self, m, n, ops):
    """
    :type m: int
    :type n: int
    :type ops: List[List[int]]
    :rtype: int
    """
    x=m-1
    y=n-1
    for op in ops:
    # if x < =op[0]-1 and y <= op[1]-1:
    if x >=op[0]-1 and y >=op[1]-1:
    x=op[0]-1
    y=op[1]-1
    elif op[0]-1< x and op[1]-1 >=y :
    x=op[0]-1

            elif x <op[0]-1 and op[1]-1 <y:    
                y=op[1]-1
        return (x+1)*(y+1)

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.