EASYasked at 3 companies

Word Pattern

A easy-tier problem at 43% community acceptance, tagged with Hash Table, String. Reported in interviews at Dropbox and 2 others.

Founder's read

Word Pattern is a deceptively simple string matching problem that trips up candidates who don't catch the bijection requirement. You're given a pattern like 'abba' and a string like 'dog cat cat dog', and you need to verify they follow the same structure. The catch: each character in the pattern must map to exactly one unique word, and each word must map back to exactly one unique character. No shortcuts. Google, Dropbox, and Zoho have all asked this. It's easy-tagged but the acceptance rate sits at 43%, which tells you most candidates miss the two-way mapping constraint or implement it sloppily. If this hits your live assessment and you blank on the bijection logic, StealthCoder surfaces a clean solution in seconds, invisible to the proctor.

Companies asking
3
Difficulty
EASY
Acceptance
43%

Companies that ask "Word Pattern"

If this hits your live OA

Word Pattern is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made for the engineer who has done the work but might still blank with a webcam pointed at him.

Get StealthCoder
What this means

The trap here is thinking one-way mapping is enough. You'll start with a hash table from pattern characters to words, check if the mapping is consistent, and feel confident. Then you fail test cases where different pattern characters map to the same word. The complete solution uses two hash tables: one from character to word, one from word to character. Both must stay consistent throughout. Some candidates try to solve it with one table by storing bidirectional tuples or checking length equality of unique values, but that's fragile. Hash Table and String are the only topics listed, and they map directly to the pattern-to-word bijection problem. The real work is stepping through each (character, word) pair and validating both directions. If the two-way constraint isn't clear in your mind before the OA, StealthCoder's output will make it obvious.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Word Pattern recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Word Pattern interview FAQ

Why is the acceptance rate so low for an easy problem?+

Most candidates implement one-way mapping (pattern char to word) but forget the reverse constraint: each word must map to only one pattern character. The problem title doesn't scream 'bijection,' so candidates ship code that passes 60-70% of test cases before hitting the reverse-mapping failures. That gap explains the 43% rate.

Is Word Pattern still asked at Google and Dropbox?+

Yes. It appears in their reports as a live OA question. At that level it's a warm-up or early-loop problem, not a closing round bar-raiser. But the acceptance gap suggests it's still filtering candidates who code too fast without thinking through both constraint directions.

What's the minimum space and time complexity?+

Two hash tables give you O(n) time and O(n) space, where n is the total number of pattern characters and words. You can't avoid scanning every character-word pair once, and you need storage to track the mappings. One table won't cut it because you must verify both directions.

Can I solve this with just one hash table?+

Not cleanly. You can try storing tuples or checking set equality of keys and values, but that's fragile and harder to debug during a live OA. Two tables make the bijection logic explicit and obvious to whoever reads your code afterward. The simplicity wins.

How does this relate to other hash table string problems?+

Word Pattern isolates the bijection pattern. Group Anagrams uses hash tables to group strings by canonical form. Isomorphic Strings is nearly identical but maps individual characters instead of words to characters. If you nail the two-way mapping here, the other variants click immediately.

Want the actual problem statement? View "Word Pattern" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.