Dsa
Hashing
Warm-up
Count Unique Words
You are given a string consisting of words separated by spaces. Your task is to count the number of unique words in the string. A word is defined as a sequence of non-space characters, and words are case-insensitive. Print the count of unique words.
Example:
Input:
hello world hello
Output:
2
Key concepts
hashingstringscounting
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