Matrix Prime Check
EasyP3Coding
Return how many elements of an N x M matrix are prime numbers. Equal values at different cells are counted separately. A prime is an integer greater than 1 whose only divisors are 1 and itself.
Example 1
- Input
- matrix = [[1,2,3],[4,5,6]]
- Output
- 3
Example 2
- Input
- matrix = [[0,1],[4,6]]
- Output
- 0
Example 3
- Input
- matrix = [[2]]
- Output
- 1
Constraints
- 1 <= N, M <= 100
- 0 <= matrix[i][j] <= 10^6
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.