Tap here to switch tabs
Problem
Submissions

Problem: Cells with Odd Values in a Matrix

med
30 min
Try to solve the Cells with Odd Values in a Matrix problem.

Statement

Given two integers m and n representing the dimensions of an m $ imes$ n matrix initialized with all 00 values, and a two dimensional integer array indices where each element indices[i] = [r_i, c_i].

For each pair [r_i, c_i], apply the following operations:

  1. Increment all elements in row r_i by 11.

  2. Increment all elements in column c_i by 11.

Return the number of cells in the matrix with odd values after processing all pairs in indices.

Constraints:

  • 1≤1 \leq m, n ≤50\leq 50

  • 1≤1 \leq indices.length ≤100\leq 100

  • 0≤0 \leq r_i << m

  • 0≤0 \leq c_i << n

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Cells with Odd Values in a Matrix

med
30 min
Try to solve the Cells with Odd Values in a Matrix problem.

Statement

Given two integers m and n representing the dimensions of an m $ imes$ n matrix initialized with all 00 values, and a two dimensional integer array indices where each element indices[i] = [r_i, c_i].

For each pair [r_i, c_i], apply the following operations:

  1. Increment all elements in row r_i by 11.

  2. Increment all elements in column c_i by 11.

Return the number of cells in the matrix with odd values after processing all pairs in indices.

Constraints:

  • 1≤1 \leq m, n ≤50\leq 50

  • 1≤1 \leq indices.length ≤100\leq 100

  • 0≤0 \leq r_i << m

  • 0≤0 \leq c_i << n