Matrix Sum Prime Check
EasyP3Coding
Add up all elements of an N x M matrix and return true if the total is a prime number, otherwise false.
Example 1
- Input
- matrix = [[1,2],[3,5]]
- Output
- true
Example 2
- Input
- matrix = [[1,2],[3,4]]
- Output
- false
Example 3
- Input
- matrix = [[2]]
- Output
- true
Constraints
- 1 <= N, M <= 100
- 0 <= matrix[i][j] <= 1000
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 11. ⌘Enter runs, ⌘⇧Enter submits.