Product of Rows
EasyP3Coding
For each row of an N x M matrix, compute the product of its elements. Return the N products from the first row to the last.
Example 1
- Input
- matrix = [[1,2,3],[4,5,6]]
- Output
- [6,120]
Example 2
- Input
- matrix = [[2]]
- Output
- [2]
Example 3
- Input
- matrix = [[0,5],[3,3]]
- Output
- [0,9]
Constraints
- 1 <= N, M <= 10
- -10 <= matrix[i][j] <= 10
- Every product fits in a 32-bit signed integer.
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 10. ⌘Enter runs, ⌘⇧Enter submits.