Dsa
Hashing
Easy
Circular ID Registry
In a secure facility, rotating security IDs are used. Two ID strings are considered 'equivalent' if one can be obtained by cyclically shifting the other (e.g., 'abc', 'bca', and 'cab' are equivalent). Given a list of observed IDs, count how many unique security entities are represented.
Input Format:
- Line 1: An integer N, the number of IDs.
- Next N lines: Each line contains a string ID.
Output Format:
- A single integer representing the number of unique entities.
Example:
Input:
3
abc
bca
xyz
Output:
2
Key concepts
hashingstringscanonical form
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