Dsa
Hashing
Easy
Coupon Code Collision
A marketing team generates coupon codes. To avoid confusion, they want to find 'collisions'. A collision occurs if two codes are identical after: 1) Converting to lowercase, and 2) Removing all vowels (a, e, i, o, u). Given a list of codes, find the 'normalized' version (lowercase, no vowels) that has the highest number of collisions. If tied, print the one that is alphabetically first.
Example:
Input:
4
Apple
APPL
Banana
BNN
Output: ppl (Apple and APPL both normalize to 'ppl', while Banana/BNN normalize to 'bnn'. Both groups have 2, but 'ppl' > 'bnn' is wrong, 'bnn' < 'ppl' alphabetically, so output 'bnn').
Key concepts
hashingstring manipulationfrequency
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