1 line Python

  • 0

    After some observation we can easily transfer this problem into find the minimum among two coordinates since every time we update values, we update them from the left corner. And then it is very straight forward.

    class Solution(object):
        def maxCount(self, m, n, ops):
            :type m: int
            :type n: int
            :type ops: List[List[int]]
            :rtype: int
            return min(ops)[0] * min(ops, key = lambda x: x[1])[1] if ops else m * n

Log in to reply

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