← Nextdoor Interview Insights

Nextdoor·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Nextdoor coding round, basically a Merge Intervals variant but with weekly calendar strings instead of plain numbers. The twist kept it interesting but also added a lot of places to mess up.

Questions Asked (1)

Q1

Given a list of time intervals expressed as string pairs in the format 'DAY HH:MM' (where DAY is Mon through Sun), merge all overlapping or adjacent intervals and return the result sorted chronologically. Intervals where the end comes before the start should be treated as wrapping past Sunday into the following Monday, so split them into two sub-intervals before merging.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The core merge logic wasn't the hard part, I've done LC 56 before.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, normalize each interval into a linear numeric representation by converting day and time to minutes from Monday 00:00, splitting any wrapping intervals into two parts. Then sort all intervals by start time and merge overlapping or adjacent ones, finally converting back to the original format.

Pro tip: Clarify upfront whether intervals are inclusive or exclusive at endpoints, as this affects adjacency merging (e.g., 10:00-11:00 and 11:00-12:00 are adjacent if end is exclusive). Also, mention that you'd handle edge cases like full-week intervals and empty input.

1. Clarify requirements and edge cases

Ask about interval inclusivity, time zone assumptions, and whether intervals can span multiple weeks. Confirm the expected output format and sorting order.

2. Normalize intervals to linear time

Convert each 'DAY HH:MM' to total minutes from Monday 00:00. For wrapping intervals (end < start), split into two: [start, end of week] and [start of week, end].

3. Sort and merge intervals

Sort all intervals by start time. Iterate and merge if the next interval's start is <= current end (or < if exclusive). Keep track of merged intervals.

4. Handle week wrap-around merging

After merging, check if the first and last intervals can merge across the week boundary (e.g., last ends Sunday 24:00 and first starts Monday 00:00). If so, combine them.

5. Convert back and return result

Convert merged intervals back to 'DAY HH:MM' format, ensuring chronological order. If an interval spans the entire week, represent it appropriately.

Key Points to Mention

  • Time normalization: converting day and time to a single integer (minutes from Monday 00:00) simplifies comparisons and sorting.
  • Splitting wrapping intervals: essential to handle intervals that cross Sunday-Monday boundary correctly.
  • Sorting: O(n log n) time complexity, which is optimal for comparison-based merging.
  • Merging condition: depends on whether intervals are inclusive or exclusive; must be clarified.
  • Week wrap-around: after merging, check if the last and first intervals can merge to form a continuous interval across the week boundary.
  • Edge cases: empty input, single interval, full-week interval, intervals that exactly touch at boundaries.

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