Cells with Odd Values in a Matrix Problem

Cells with Odd Values in a Matrix Problem — ExecCode Easy DSA Practice

Solve the Cells with Odd Values in a Matrix problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given m, n, and indices, return the number of odd-valued cells in the matrix after applying the increment to all locations in indices. Your task is to there is an m x n matrix that is initialized to all 0's. There is also a 2D array indices where each indices[i] = [ri, ci] represents a 0-indexed location to perform some increment operations on the matrix. For each location indices[i], do both of the following: 1. Return the required answer exactly as shown in the examples.

Examples

Input {"m": 2, "n": 3, "indices": [[0, 1], [1, 1]]}; Output 6. Input {"m": 2, "n": 2, "indices": [[1, 1], [0, 0]]}; Output 0

Constraints

1 <= m, n <= 50 1 <= indices.length <= 100 0 <= ri < m 0 <= ci < n

Practice Cells with Odd Values in a Matrix free on ExecCode. Browse DSA problems, topic map, and placement guides.