PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates understanding of interval-merging algorithms and temporal data normalization, testing competency in handling time-based ranges, overlap detection, and chronological ordering within the Coding & Algorithms domain.

  • medium
  • Nextdoor
  • Coding & Algorithms
  • Software Engineer

Merge Weekly Time Intervals

Company: Nextdoor

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a list of time intervals within a single week. Each time is written as a day-of-week plus a 24-hour clock, for example `Sat 13:00` or `Mon 09:30`. Each interval has the form `[start, end]`, where `start` and `end` are timestamps in the same weekly timeline, and `start <= end`. Write a function that merges all overlapping intervals and returns the merged result in chronological order. Example input: - `[Mon 09:00, Mon 11:00]` - `[Mon 10:30, Mon 12:00]` - `[Sat 13:00, Sat 14:00]` - `[Sat 13:30, Sat 15:00]` Example output: - `[Mon 09:00, Mon 12:00]` - `[Sat 13:00, Sat 15:00]` You should explain how to parse the weekday/time format into a comparable numeric value, then apply interval merging efficiently.

Quick Answer: This question evaluates understanding of interval-merging algorithms and temporal data normalization, testing competency in handling time-based ranges, overlap detection, and chronological ordering within the Coding & Algorithms domain.

Parse weekly day/time intervals, merge overlapping intervals, and return the merged intervals in chronological order.

Constraints

  • Inputs are provided as Python literals matching the function signature.
  • Return a deterministic exact-match result.

Examples

Input: ([['Mon 09:00','Mon 11:00'], ['Mon 10:30','Mon 12:00'], ['Sat 13:00','Sat 14:00'], ['Sat 13:30','Sat 15:00']],)

Expected Output: [['Mon 09:00', 'Mon 12:00'], ['Sat 13:00', 'Sat 15:00']]

Explanation: Prompt example.

Input: ([['Sun 23:00','Sun 23:30'], ['Mon 00:00','Mon 01:00']],)

Expected Output: [['Mon 00:00', 'Mon 01:00'], ['Sun 23:00', 'Sun 23:30']]

Explanation: Chronological week order.

Input: ([],)

Expected Output: []

Explanation: No intervals.

Hints

  1. Choose a representation that makes the core operation simple.
  2. Handle empty and boundary inputs before the main algorithm.
Last updated: Jun 27, 2026

Loading coding console...

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.

Related Coding Questions

  • Group Photos and Sort Feed Items - Nextdoor (medium)
  • Simulate Transaction Lock Scheduling - Nextdoor (hard)
  • Build Ranked Feed With Photo Batching - Nextdoor (medium)
  • Merge overlapping weekly time intervals - Nextdoor (medium)
  • Write SQL for app metrics - Nextdoor (hard)