Dsa
Matrix
Easy
Matrix Element Count
Write a program to count the occurrences of a specific number in a given matrix. The input consists of a matrix followed by the number to find. Return the count of occurrences of that number in the matrix.
Example:
Input:
1 1 1
1 2 3
1 4 5
1
Output:
5
Key concepts
matrixcounting
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now