Cells With Odd Values In A Matrix, is a LeetCode problem. In this post we will see how we can solve this challenge in C++

Problem Description

Example 1 :

Input: n = 2, m = 3, indices = [[0,1],[1,1]] Output: 6 Explanation: Initial matrix = [[0,0,0],[0,0,0]]. After applying first increment it becomes [[1,2,1],[0,1,0]]. The final matrix will be [[1,3,1],[1,3,1]] which contains 6 odd numbers.

Example 2 :

Input: n = 2, m = 2, indices = [[1,1],[0,0]] Output: 0 Explanation: Final matrix = [[2,2],[2,2]]. There is no odd numb ....

You can find the full details of the problem Cells with Odd Values in a Matrix at LeetCode

Solution: Please check the main.cpp snippet for the solution.

This solution originally posted at: Github by @kamyu104