I recently applied for a Meta New Grad SWE role, and after my resume cleared I got an interview scheduled quickly. This debrief covers the full flow of the coding round, my real experience, and the two problems I hit. If you're also prepping for Meta's new-grad hiring, I hope this note helps you dial in your pace and mindset.
Environment and Format Overview
The whole interview ran over Zoom, and coding happened in CoderPad (if you get a system design round, the diagramming switches to Excalidraw). One thing sets Meta apart from many companies: Meta's coding round does not require your code to actually pass test cases. It cares more about your thought process and rigor. After you finish writing, you must do a dry run: walk the data line by line and proactively call out edge cases. That step tests your grasp of the problem and whether you can logically guarantee correctness.
| Item | Details |
|---|---|
| Platform | Zoom + CoderPad (Excalidraw for system design) |
| Format | Live coding plus verbal explanation |
| Total time | 45 minutes |
| Count | 2 problems, about 20 minutes each, with a 5-minute buffer |
| Focus | Clarity of thinking, dry-run rigor, edge-case coverage |
The pace is tight: if you get stuck on problem 1, you won't finish problem 2. So when you recognize a familiar tag question, judge fast and commit quickly, saving time for explanation and the dry run.
Problem 1: Merge Intervals
Background
Given a set of intervals, merge all overlapping ones into as few intervals as possible. This is a very typical tag question that almost everyone who has practiced has seen.
Approach
- Sort the intervals by their start value.
- Scan left to right: if the current interval overlaps the last interval in the result, merge them into a larger one (set the end to the max of the two ends); otherwise, push the current interval as a new segment.
The key during the dry run is to proactively verify boundaries: do exactly-adjacent intervals count as overlapping? how do you handle empty input? What the interviewer cares about is whether you bring these up on your own.
Python Solution
from typing import List
def merge_intervals(intervals: List[List[int]]) -> List[List[int]]:
"""Merge all overlapping intervals.
Sort by start, then scan linearly: merge into the previous segment
when they overlap, otherwise start a new one.
"""
# Edge case: empty input returns an empty list
if not intervals:
return []
# Step 1: sort by start ascending
intervals.sort(key=lambda x: x[0])
# Step 2: seed the result with the first interval
merged = [intervals[0][:]]
# Step 3: scan the remaining intervals
for start, end in intervals[1:]:
last = merged[-1]
if start <= last[1]:
# Overlap (including exactly adjacent): take the larger end
last[1] = max(last[1], end)
else:
# No overlap: start a new segment
merged.append([start, end])
return merged
Dry Run Walkthrough
An example with multiple overlaps makes the point best: [[1,3],[2,6],[8,10],[15,18]].
| Step | Current interval | Result state | Note |
|---|---|---|---|
| After sort | — | — | [1,3],[2,6],[8,10],[15,18] starts are already ordered |
| Init | [1,3] |
[[1,3]] |
Push the first |
Scan [2,6] |
2 <= 3 |
[[1,6]] |
Overlap, merge into [1,6] |
Scan [8,10] |
8 > 6 |
[[1,6],[8,10]] |
No overlap, new segment |
Scan [15,18] |
15 > 10 |
[[1,6],[8,10],[15,18]] |
No overlap, new segment |
Final result [[1,6],[8,10],[15,18]]: the first two merge into [1,6], the last two stay unchanged.
Boundaries to raise proactively:
- Empty input
[]returns[]. - Exactly adjacent, e.g.
[1,4],[4,5]: since4 <= 4counts as overlap, they merge into[1,5](confirm the convention with the interviewer). - Fully contained, e.g.
[1,10],[2,3]: still merges to[1,10], withmaxensuring the end is never shrunk.
Time complexity: O(n log n), dominated by the sort. Space complexity: O(n) for the result (not counting the sort itself).
Problem 2: Course Schedule -- Cycle Detection in a Directed Graph
Background
The second problem was clearly a bit harder: a classic Course Schedule variant. Given a course count and prerequisite pairs, decide whether you can finish all courses. This boils down to detecting a cycle in a directed graph: a cycle means a circular dependency, so you can never finish.
Approach
Use BFS topological sort (Kahn's algorithm):
- Count each node's in-degree (how many prerequisites point to it).
- Put all in-degree-0 courses in a queue, repeatedly pop a course, "finish" it, and decrement the in-degree of each neighbor it points to; a neighbor whose in-degree drops to 0 gets enqueued.
- If the number of processed courses equals the total, there's no cycle, return
True; otherwise there's a cycle, returnFalse.
Explain why you chose topological sort: the problem is really about whether the dependencies can be linearized. An in-degree-0 node is a course with no unmet prerequisites, and peeling them off layer by layer detects cycles.
Python Solution
from collections import deque
from typing import List
def can_finish(num_courses: int, prerequisites: List[List[int]]) -> bool:
"""Decide whether all courses can be finished (i.e. the graph is acyclic).
Kahn's topological sort: repeatedly remove in-degree-0 nodes and check
whether we can remove all of them.
prerequisites[i] = [a, b] means b must be taken before a (b -> a).
"""
# Build the adjacency list and in-degree array
graph = [[] for _ in range(num_courses)]
indegree = [0] * num_courses
for course, prereq in prerequisites:
graph[prereq].append(course) # prereq -> course
indegree[course] += 1
# Step 1: enqueue every course with in-degree 0
queue = deque(i for i in range(num_courses) if indegree[i] == 0)
# Step 2: "finish" courses one by one, counting how many are processed
processed = 0
while queue:
node = queue.popleft()
processed += 1
for neighbor in graph[node]:
indegree[neighbor] -= 1
if indegree[neighbor] == 0:
queue.append(neighbor)
# Step 3: no cycle iff every course was processed
return processed == num_courses
Dry Run Walkthrough
No-cycle example: num_courses = 2, prerequisites = [[1, 0]] (course 0 must come before course 1).
| Step | Queue | processed | Note |
|---|---|---|---|
| Initial in-degrees | — | 0 | Course 0 in-degree 0, course 1 in-degree 1 |
| Enqueue | [0] |
0 | Only course 0 has in-degree 0 |
| Pop 0 | [1] |
1 | Course 1 in-degree drops to 0, enqueued |
| Pop 1 | [] |
2 | No neighbors |
Topological order [0, 1], processed == 2 == num_courses, returns True.
Cycle counterexample: num_courses = 2, prerequisites = [[0, 1], [1, 0]] (0 depends on 1, and 1 depends on 0, mutually). Both courses have in-degree 1, so there is no in-degree-0 node to enqueue at the start, the queue stays empty, and processed = 0 < num_courses, returns False.
Extra boundaries to verify:
- No prerequisites
prerequisites = []: every course has in-degree 0, all get processed, returnsTrue. - Single course
num_courses = 1: trivially finishable, returnsTrue.
Time complexity: O(V + E), V is the number of courses, E is the number of prerequisite pairs. Space complexity: O(V + E) for the adjacency list, in-degree array, and queue.
Interview Flow Tips
Meta's coding round isn't trying to trick you. It checks two things: your familiarity with common tag types, and whether you can finish cleanly under time pressure.
- Tag accumulation is fundamental: intervals, sorting, graphs, sliding window, and binary search are high-frequency types. Practice them until you recognize the pattern on sight, so you leave room for explanation and the dry run within 20 minutes.
- The dry run is the second key: after writing, always walk a concrete example, especially covering boundaries: empty input, single element, exactly adjacent but not overlapping, cycle vs. no cycle. Raising these yourself builds more trust than code that happens to run correctly.
- Pace management: commit fast on problem 1, don't linger, and leave enough time for problem 2.
FAQ
Q1: Does Meta's coding round require the code to pass tests?
Not necessarily. This round weighs your thought process and rigor more. After writing, dry-running the data line by line and proactively pointing out edge cases to argue correctness logically matters more than code that happens to pass.
Q2: With 45 minutes and two problems, how should I pace myself?
About 20 minutes per problem, with a 5-minute buffer. If problem 1 is a familiar tag type, commit and finish it quickly so you can spend the slack on explanation and the dry run. If you linger too long on problem 1, you basically won't finish problem 2.
Q3: In Merge Intervals, do exactly-adjacent intervals count as overlapping?
It depends on the interviewer's definition, so ask up front. A common convention is that [1,4] and [4,5] overlap because the endpoints touch and merge into [1,5]; using start <= last_end in code covers this case.
Q4: For finishing all courses, why topological sort instead of plain DFS?
The problem is fundamentally about whether the directed graph has a cycle. Kahn's topological sort repeatedly removes in-degree-0 nodes, and if it can't remove them all, there's a circular dependency. The approach is intuitive, easy to explain out loud, and easy to dry-run.
Q5: Which boundaries should the dry run cover most?
Empty input, single element, intervals that are exactly adjacent but not overlapping, and both cycle and no-cycle counterexamples for graph problems. Raising these yourself is the key to scoring in this round.
Prepping for Meta's new-grad SWE coding round? We know Meta's CoderPad pace and its dry-run preferences, and can help you polish your high-frequency tag types and edge-case narration.
Add WeChat Coding0201 now to get a one-on-one custom prep plan.
Contact
- WeChat: Coding0201
- Email: [email protected]
- Telegram: @OAVOProxy