public class Solution {
    public int MaxCount(int m, int n, int[,] ops) {
        var row = ops.GetLength(0);
            var col = ops.GetLength(1);//2

            if (row == 0 || col == 0)
            {
                return m * n;
            }

            var minRow = int.MaxValue;
            var minCol = int.MaxValue;
            for (int i = 0; i < row; i++)
            {
                var r = ops[i, 0];
                if (r < minRow)
                {
                    minRow = r;
                }

                var c = ops[i, 1];
                if (c < minCol)
                {
                    minCol = c;
                }
            }
            var result = minRow * minCol;
            return result;
    }
}

https://leetcode.com/problems/range-addition-ii/#/description

posted on 2017-06-01 11:09  Sempron2800+  阅读(103)  评论(0编辑  收藏  举报