← Back to blog Meta SDE Five-Round Debrief: Word Search II Trie + Sliding Window + BFS State Transitions + Real-Time Notification System Design
Meta

Meta SDE Five-Round Debrief: Word Search II Trie + Sliding Window + BFS State Transitions + Real-Time Notification System Design

2026-06-07

I went through Meta's SDE loop—three coding rounds, one behavioral, one system design, spread across two days, all online. This post mainly records each round's problem types and solution approaches, with the emphasis on the problems themselves for review-and-grind purposes.

1. Five Rounds at a Glance

Round Type Problems
1 Coding Word Search II (Trie) + Search in Rotated Sorted Array
2 Coding Longest substring with at most K distinct chars + Shortest Distance from All Buildings
3 Behavioral conflict / decision / leadership (TPM-led)
4 Coding Shortest state-transition BFS + Product of Two RLE Arrays
5 System Design Real-time Notification System

2. Round 1 Coding: Word Search II + Rotated Array

Problem 1: Word Search II (Trie pruning)

Like LeetCode 212 but more open-ended: given a character matrix and a word list, return all words findable in the matrix, moving up/down/left/right without reusing a cell. Brute-force DFS times out. After the interviewer hinted "can we avoid re-visiting certain paths," I switched to Trie + DFS pruning.

def find_words(board, words):
    trie = {}
    for w in words:                       # build prefix tree, store full word at leaf
        node = trie
        for c in w:
            node = node.setdefault(c, {})
        node['#'] = w
    R, C, res = len(board), len(board[0]), set()

    def dfs(r, c, node):
        ch = board[r][c]
        if ch not in node:
            return
        nxt = node[ch]
        if '#' in nxt:
            res.add(nxt['#'])
        board[r][c] = '*'                 # mark visited to avoid reuse
        for dr, dc in ((1,0),(-1,0),(0,1),(0,-1)):
            nr, nc = r+dr, c+dc
            if 0 <= nr < R and 0 <= nc < C and board[nr][nc] != '*':
                dfs(nr, nc, nxt)
        board[r][c] = ch                  # backtrack
    for i in range(R):
        for j in range(C):
            dfs(i, j, trie)
    return list(res)

I added visited marking, path joining, and prefix pruning; it passed all test cases.

Problem 2: Search in Rotated Sorted Array

A classic tagged binary-search variant—instant.

3. Round 2 Coding: Sliding Window + Shortest Distance from All Buildings

Problem 1: Longest substring with at most K distinct chars (return the substring)

Classic sliding window with a twist: return the actual substring, not the length. A hash map tracks character frequency; two pointers maintain the window and shrink when distinct count exceeds K.

def longest_k_distinct(s: str, k: int) -> str:
    cnt = {}
    left = best_l = best_len = 0
    for right, ch in enumerate(s):
        cnt[ch] = cnt.get(ch, 0) + 1
        while len(cnt) > k:               # more than K distinct chars, shrink left
            cnt[s[left]] -= 1
            if cnt[s[left]] == 0:
                del cnt[s[left]]          # must drop zero-count keys, else len(cnt) is wrong
            left += 1
        if right - left + 1 > best_len:
            best_len, best_l = right - left + 1, left
    return s[best_l:best_l + best_len]

The interviewer was detail-heavy: why drop zero-count chars from the hash table (otherwise len(cnt) is off), how to handle Unicode characters, and whether Counter could replace dict.

Problem 2: Shortest Distance from All Buildings

A hard multi-source BFS—I'd grinded it before, so it went smoothly.

4. Round 3 Behavioral

The interviewer was a TPM; questions centered on conflict resolution, decision making, leadership.

Overall it gauged real experience and retrospection ability—good vibe.

5. Round 4 Coding: Shortest State-Transition BFS + RLE

Problem 1: Shortest state-transition path

Given a start state, target state, and a set of legal transition rules (+1, -1, ×2, ÷2, etc.), find the shortest transformation path. I first asked whether states could be revisited; the interviewer said "yes but only if the state is meaningful again"—a revisit must carry new path meaning.

from collections import deque

def min_transforms(start, target, ops):
    q = deque([(start, 0)])
    visited = {start}
    while q:
        state, steps = q.popleft()
        if state == target:
            return steps
        for nxt in ops(state):            # ops yields all legal next states
            if nxt not in visited:
                visited.add(nxt)          # lazy visited marking guards against loops / OOM
                q.append((nxt, steps + 1))
    return -1

The interviewer pushed on how to prevent OOM when the state space is huge; I answered with boundary conditions and lazy visited marking, and covered the time/space bottleneck.

Problem 2: Product of Two Run-Length Encoded Arrays

A LeetCode original—two pointers aligning run lengths, smooth.

6. Round 5 System Design: Real-Time Notification System

Design a real-time notification system: support massive user subscribe, low-latency push, multi-device, with HA and scalability.

I first split into modules: Producer, Message Queue, Dispatcher, Device Registry, Delivery Tracker.

Module Choice Rationale
Message Queue Kafka partitioning + durability
Dispatcher stateless, horizontal scale consumer-group load balancing
Device Registry Redis per-user active devices
Reliability retry queue + exponential backoff + DLQ no message loss
QoS VIP priority queue important messages first
Observability Prometheus (delivery latency / fail rate) post-launch monitoring

The interviewer kept digging: "what if the Dispatcher goes down," "how do you handle an offline device." I answered with retry queue + exponential backoff + dead-letter queue, plus QoS control and monitoring metrics. It was clear that system design isn't about reciting concepts—it's about real-world fault and latency tolerance.

7. Summary

Meta's problems aren't especially hard, but they heavily value detail and completeness of reasoning: coding wants clean code and edge handling (zeroing counts, visited marking, Unicode); behavioral probes deep but is preppable; system design wants clear structure, sensible decomposition, and depth on each module's rationale and scaling strategy.


FAQ

Q1: How many rounds is Meta SDE, and what structure?

This case was five rounds: three coding, one behavioral, one system design, done online over two days.

Q2: What problem types does Meta coding favor?

Mostly high-frequency: Word Search II (Trie pruning), sliding window (at most K distinct chars), multi-source BFS (Shortest Distance from All Buildings), state-transition BFS, RLE. The difficulty isn't the problem but clean code and edge details (zeroing counts, visited marking, Unicode).

Q3: How do I prep Meta system design?

Take real-time notification: split into Producer / Queue / Dispatcher / Registry / Tracker, pick Kafka + stateless Dispatcher + Redis, and focus on fault handling (Dispatcher down, device offline, retry + DLQ) and observability—not just memorizing a diagram.

Q4: How do I efficiently practice these five rounds?

Practice high-frequency coding until you can narrate edges while writing, and walk system design through "decompose → pick tech → faults → monitoring." If you want timed practice on these exact problems, notification-system specialization, or live VO support / VO proxy coordination, send the JD so we can run question-type prediction first and build a plan.


Preparing for Meta?

Meta tests clean code + edge details + depth of system-design decomposition. oavoservice offers full-loop Meta practice: timed mocks on Word Search II / sliding window / state-transition BFS, notification-system design walkthroughs, and TPM-style BQ drills, with live VO support / VO proxy coordination too. Coaches include former Meta senior engineers familiar with the "coding-detail-heavy, system-design-fault-digging" scoring style.

Add WeChat Coding0201 now to get Meta questions and practice.

Contact