@@ -0,0 +1,1083 @@
+package leetcode;%0A%0A/**%0A * https://leetcode.com/problems/cells-with-odd-values-in-a-matrix/%0A */%0Apublic class Problem1252 %7B%0A    public int oddCells(int n, int m, int%5B%5D%5B%5D indices) %7B%0A        int%5B%5D%5B%5D matrix = new int%5Bn%5D%5Bm%5D;%0A        for (int%5B%5D index : indices) %7B%0A            int row = index%5B0%5D;%0A            int col = index%5B1%5D;%0A            matrix%5Brow%5D%5Bcol%5D += 2;%0A            // up%0A            for (int r = row - 1; r %3E= 0; r--) %7B%0A                matrix%5Br%5D%5Bcol%5D++;%0A            %7D%0A            // right%0A            for (int c = col + 1; c %3C m; c++) %7B%0A                matrix%5Brow%5D%5Bc%5D++;%0A            %7D%0A            // down%0A            for (int r = row + 1; r %3C n; r++) %7B%0A                matrix%5Br%5D%5Bcol%5D++;%0A            %7D%0A            // left%0A            for (int c = col - 1; c %3E= 0; c--) %7B%0A                matrix%5Brow%5D%5Bc%5D++;%0A            %7D%0A        %7D%0A        int answer = 0;%0A        for (int i = 0; i %3C n; i++) %7B%0A            for (int j = 0; j %3C m; j++) %7B%0A                if (matrix%5Bi%5D%5Bj%5D %25 2 != 0) %7B%0A                    answer++;%0A                %7D%0A            %7D%0A        %7D%0A        return answer;%0A    %7D%0A%7D%0A

Solve problem 1252