Substring with Concatenation of All Words

Asked atMeta
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
  1. 01Verify every word has the same length.
  2. 02Build required word frequencies and scan once per offset.
  3. 03Advance in word-sized steps while tracking a current window map.
  4. 04Record starts when the window contains exactly all words, then slide one word.

Reference answer

Then expect these follow-ups

  • Why must every offset be scanned?

    Tests: alignment

  • How are duplicates handled?

    Tests: frequency maps

Hiring now

Get the Meta interview, not just the prep

landed applies to roles like these for you, on each company’s own site, with answers written for the role.

Get 5x interviews10 free auto-applies. No card.
Or practice this question first

Next question