Dsa
Hashing
Warm-up
Unique Domain Count
You are given a list of URLs. Count the number of unique domains among them. A URL has the format 'http(s)://domain/path' or 'domain/path'. Ignore the scheme (http, https) while counting unique domains.
Input Format:
- A single line containing space-separated URLs.
Output Format:
- Print the count of unique domains.
Example:
Input:
"http://google.com path/to/resource https://google.com https://youtube.com"
Output:
2
Key concepts
hashingstrings
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