PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Nextdoor

Merge overlapping weekly time intervals

Last updated: Jun 9, 2026

Quick Overview

This question evaluates the ability to parse weekday and 24-hour time strings, reason about interval overlap, and apply efficient merging and sorting techniques for time-based intervals.

  • medium
  • Nextdoor
  • Coding & Algorithms
  • Machine Learning Engineer

Merge overlapping weekly time intervals

Company: Nextdoor

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a list of time intervals representing meetings. Each interval is a pair of strings in the format: - `"<Day> <H>:<MM>"` (24-hour time) - `<Day>` is one of `Mon, Tue, Wed, Thu, Fri, Sat, Sun` - Examples: `"Mon 9:00"`, `"Mon 13:00"`, `"Tue 09:30"` Example input: ```text [["Mon 9:00", "Mon 13:00"], ["Mon 11:00", "Mon 16:00"]] ``` Two intervals overlap if they occur on the same day and their time ranges intersect (endpoints may be treated as overlapping, i.e., `[9:00, 13:00]` overlaps `[13:00, 14:00]`). Task: 1. Parse the strings into comparable time values. 2. Merge all overlapping intervals (per day) and return the merged list. Output requirements: - Return intervals in the same string format. - Sort output by day-of-week (Mon→Sun), then by start time. Clarify/assume: - All intervals start < end. - Intervals may span different days, but each individual interval’s start and end are on the same day. - Input size can be large enough that an efficient solution is expected (better than \(O(n^2)\)).

Quick Answer: This question evaluates the ability to parse weekday and 24-hour time strings, reason about interval overlap, and apply efficient merging and sorting techniques for time-based intervals.

Related Interview Questions

  • Group Photos and Sort Feed Items - Nextdoor (medium)
  • Simulate Transaction Lock Scheduling - Nextdoor (hard)
  • Build Ranked Feed With Photo Batching - Nextdoor (medium)
  • Merge Weekly Time Intervals - Nextdoor (medium)
  • Write SQL for app metrics - Nextdoor (hard)
Nextdoor logo
Nextdoor
Mar 1, 2026, 12:00 AM
Machine Learning Engineer
Technical Screen
Coding & Algorithms
11
0

You are given a list of time intervals representing meetings. Each interval is a pair of strings in the format:

  • "<Day> <H>:<MM>" (24-hour time)
  • <Day> is one of Mon, Tue, Wed, Thu, Fri, Sat, Sun
  • Examples: "Mon 9:00" , "Mon 13:00" , "Tue 09:30"

Example input:

[["Mon 9:00", "Mon 13:00"], ["Mon 11:00", "Mon 16:00"]]

Two intervals overlap if they occur on the same day and their time ranges intersect (endpoints may be treated as overlapping, i.e., [9:00, 13:00] overlaps [13:00, 14:00]).

Task:

  1. Parse the strings into comparable time values.
  2. Merge all overlapping intervals (per day) and return the merged list.

Output requirements:

  • Return intervals in the same string format.
  • Sort output by day-of-week (Mon→Sun), then by start time.

Clarify/assume:

  • All intervals start < end.
  • Intervals may span different days, but each individual interval’s start and end are on the same day.
  • Input size can be large enough that an efficient solution is expected (better than O(n2)O(n^2)O(n2) ).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Nextdoor•More Machine Learning Engineer•Nextdoor Machine Learning Engineer•Nextdoor Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.