← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Meta SWE coding round, one question the whole time. Classic hard sliding window problem and I spent way too long second-guessing my approach before getting anywhere useful.

Questions Asked (1)

Q1

Given a string and a list of equal-length words, find all starting indices in the string where a substring is a concatenation of every word in the list (in any order).

Algorithms & Data Structures
Author's notes

Knew immediately it was a sliding window plus hashmap problem but kept fumbling the window size calculation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a sliding window approach with a hash map to count word frequencies. Since all words are equal length, slide the window by word length and check each substring of that length against the word counts. Optimize by considering each possible starting offset modulo word length to avoid redundant checks.

Pro tip: Clarify edge cases upfront: empty string, empty word list, words with duplicates, and overlapping matches. Also, mention that the solution should handle large inputs efficiently, aiming for O(n) time where n is the string length.

1. Understand the problem and constraints

Confirm that all words are equal length and that the concatenation must include every word exactly once. Discuss edge cases like empty inputs and duplicate words.

2. Choose the right data structures

Use a hash map to store the frequency of each word in the list. This allows O(1) lookups and comparisons.

3. Design the sliding window algorithm

Iterate over each possible starting offset from 0 to wordLength-1. For each offset, slide a window of size totalWords*wordLength, updating word counts as you move.

4. Implement and validate

Write code that maintains a count of matched words and a current window word frequency map. When the window size equals the total length, check if all words are matched and record the start index.

5. Analyze complexity and test

Explain that the time complexity is O(n) where n is the string length, as each character is processed a constant number of times. Test with examples including duplicates and overlapping matches.

Key Points to Mention

  • Sliding window technique with step size equal to word length
  • Hash map for word frequency counting
  • Handling duplicate words in the list
  • Time complexity O(n) and space complexity O(m) where m is number of unique words
  • Edge cases: empty string, empty word list, words longer than string
  • Avoiding redundant checks by iterating over offsets modulo word length

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.