← Nextdoor Interview Insights

Nextdoor·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Nextdoor coding screen with a calendar interval merging problem. The twist on the standard LC 56 variant kept things interesting, and the wraparound edge case is where things could go sideways fast if you're not careful.

Questions Asked (1)

Q1

Given a list of weekly time intervals where each endpoint is represented as a string like 'DAY HH:MM' (e.g. 'Mon 09:00'), merge all overlapping or adjacent intervals. Intervals that appear to wrap past Sunday back to Monday should be split before merging. Return the merged intervals sorted chronologically within the week.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The core merge logic isn't the hard part, converting the string format to minutes-since-Monday and back is where I lost a few minutes.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the input format and edge cases, especially how wrapping intervals are represented. Then, propose a solution that normalizes intervals to minutes from the start of the week, splits any wrapping intervals, sorts them, and merges overlapping or adjacent intervals. Finally, convert the merged intervals back to the original string format and discuss trade-offs.

Pro tip: Demonstrate foresight by proactively discussing how to handle edge cases like intervals that span the entire week or have zero duration, and mention that you would write unit tests for these scenarios.

1. Clarify requirements and edge cases

Ask questions to confirm the input format, how wrapping intervals are denoted, and whether intervals are inclusive/exclusive. Discuss edge cases like zero-length intervals, full-week intervals, and adjacent intervals.

2. Normalize and split intervals

Convert each interval's start and end times to minutes from Monday 00:00. If an interval wraps (end < start), split it into two intervals: one from start to Sunday 24:00 and one from Monday 00:00 to end.

3. Sort and merge intervals

Sort the normalized intervals by start time. Iterate through them, merging overlapping or adjacent intervals (where the next start <= current end).

4. Convert back and handle full-week case

Convert merged intervals back to 'DAY HH:MM' format. If the merged result covers the entire week, represent it as a single interval from Monday 00:00 to Sunday 24:00 (or equivalent).

5. Analyze complexity and trade-offs

Discuss time complexity (O(n log n) due to sorting) and space complexity (O(n)). Mention alternative approaches like using a boolean array for minute-level granularity, and their trade-offs.

Key Points to Mention

  • Normalization of time to a common unit (e.g., minutes from Monday 00:00) simplifies comparisons and arithmetic.
  • Splitting wrapping intervals is crucial to avoid incorrect merges across the week boundary.
  • Sorting is necessary to efficiently merge intervals in a single pass.
  • Merging condition: next interval's start <= current interval's end (for overlapping or adjacent).
  • Edge cases: full-week coverage, zero-duration intervals, and intervals that are adjacent but not overlapping.
  • Time and space complexity: O(n log n) time, O(n) space; trade-offs with alternative approaches.

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