Dsa
Matrix
Medium
Unique Elements Matrix
Given a rectangular matrix, determine the number of unique elements in the entire matrix. The unique elements are defined as those that appear only once.
Input format:
- The first line contains two integers m and n (1 <= m, n <= 50), the number of rows and columns.
- The next m lines each contain n integers that can range from 1 to 1000.
Output format:
- A single integer representing the count of unique elements in the matrix.
Example:
Input:
3 3
1 2 3
2 4 5
6 1 5
Output:
3
Key concepts
matrixuniquenesscounting
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