Dsa
Trie
Warm-up
Shadowed Commands
In a custom CLI, a command is 'shadowed' if it is a prefix of another command (e.g., 'git' shadows 'github' if 'git' is also a valid command). Given a list of N commands, determine if any command in the list is a prefix of another command in the list.
Input Format:
1. An integer N.
2. N command strings.
Output Format:
Print 'CONFLICT' if any command is a prefix of another, otherwise print 'CLEAR'.
Example:
Input:
3
print
printf
scan
Output:
CONFLICT
Key concepts
trieprefix-freevalidation
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