Dsa
Hashing
Medium
Circular Signal Reconciliation
A series of deep-space satellites emit periodic signal patterns. Due to orbital timing, two satellites might be emitting the exact same periodic sequence, but starting at different points in the cycle. Given N signal strings, each representing one full cycle, determine how many unique signal patterns exist. Two signals are identical if one can be cyclically shifted to match the other.
Input Format:
- Line 1: An integer N, the number of signals.
- Next N lines: Each line contains a string S representing a signal's cycle.
Output Format:
- A single integer representing the number of unique signal patterns.
Example:
Input:
3
ABCDE
CDEAB
VWXYZ
Output:
2
Key concepts
hashingstringssets
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