Skip to content
Onsite

Even Sum in Rows

EasyP3Coding

For each row of a square matrix, compute the sum of the even elements in that row (0 if there are none). Return the sums from the first row to the last.

Example 1

Input
matrix = [[1,2,3],[4,5,6],[7,8,9]]
Output
[2,10,8]

Example 2

Input
matrix = [[2,4],[6,8]]
Output
[6,14]

Example 3

Input
matrix = [[1,3],[5,7]]
Output
[0,0]

Constraints

  • 1 <= N <= 100
  • -10^4 <= matrix[i][j] <= 10^4

Hints

Run checks the 3 visible tests, Submit all 10.