Wordle looks simple — until you try to color a guess with a repeated letter correctly. That edge case is the whole interview question hiding inside this game. Here's a playable clone in vanilla JS.
The two-pass coloring trap
Guess KAYAK, answer APPLE (one A). The naive "is this letter in the word?" colors BOTH A's yellow — wrong. The answer only has one A to give.
Correct algorithm is two passes:
First pass: mark greens (letter right + position right) and "use up" those answer letters.








