Dsa
Arrays
Warm-up
Count Distinct Elements
You need to count the number of distinct elements in a list of integers. First, read an integer n (the number of elements). Then, read a list of n integers. Output the count of distinct integers.
Example Input:
5
1 2 1 3 2
Example Output:
3
Key concepts
arrayscountinghashing
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