← Glean Interview Insights

Glean·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Glean SWE interview that included Word Search II as a follow-up problem. Not a lot of context to go on, but it sounds like the coding round leaned into harder graph/backtracking territory.

Questions Asked (1)

Q1

Solve Word Search II: given a board of characters and a list of words, find all words that can be formed by sequentially adjacent cells on the board.

Algorithms & Data Structures
Author's notes

This was a follow-up, so I was already a bit drained.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem constraints (board size, word count, word length) and then propose a solution that combines a Trie for efficient prefix matching with DFS backtracking on the board. Explain that this avoids redundant searches by pruning branches early when no word in the dictionary starts with the current prefix.

Pro tip: Mention that you can optimize further by storing words in the Trie nodes and removing them once found to avoid duplicate results, and by using a visited set or in-place marking to track the path. This shows attention to both correctness and efficiency.

1. Clarify constraints and edge cases

Ask about board dimensions, number of words, word lengths, and whether words can be reused. Discuss edge cases like empty board, empty word list, or words longer than the total cells.

2. Choose data structures

Propose building a Trie from the list of words to enable efficient prefix lookups. Use a set or list to store results, and consider in-place marking or a visited set for DFS.

3. Design the algorithm

Outline a DFS that starts from each cell, traverses adjacent cells, and follows the Trie. At each step, check if the current prefix exists in the Trie; if not, prune. If a word is found, add it to results.

4. Analyze complexity and optimize

State time complexity: O(M * N * 4^L) worst-case, but Trie pruning reduces it. Space: O(total characters in words) for Trie. Mention optimizations like removing found words from Trie to avoid duplicates.

5. Test with examples

Walk through a small example to verify correctness, and discuss potential pitfalls like revisiting cells or handling duplicate words.

Key Points to Mention

  • Trie data structure for efficient prefix matching and pruning
  • DFS with backtracking to explore all paths
  • In-place marking or visited set to avoid revisiting cells
  • Time and space complexity analysis
  • Handling duplicate words and removing found words from Trie
  • Edge cases: empty board, no words, words longer than board

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