PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

Practice a NVIDIA coding interview problem focused on merge overlapping time intervals. The prompt emphasizes edge cases, clean implementation, and verifiable test behavior without revealing the solution.

  • medium
  • NVIDIA
  • Coding & Algorithms
  • Data Engineer

Merge Overlapping Time Intervals

Company: NVIDIA

Role: Data Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given a list of closed time intervals. Each interval is represented as `[start, end]`, where `start <= end`. Write a function that returns the smallest list of intervals covering the same ranges after merging any intervals that overlap or touch. Two intervals touch if the end of one interval is equal to the start of the next interval. Implement: ```python def merge_intervals(intervals: list[list[int]]) -> list[list[int]]: pass ``` Examples: ```text Input: [[1, 3], [2, 6], [8, 10], [10, 12]] Output: [[1, 6], [8, 12]] ``` ```text Input: [[5, 7], [1, 2], [2, 4], [9, 9]] Output: [[1, 4], [5, 7], [9, 9]] ``` Requirements: - Return intervals sorted by start time. - Do not mutate the caller's input. - Handle an empty input list. - Handle duplicate intervals, single-point intervals, negative times, and unsorted input. Constraints: - `0 <= len(intervals) <= 100000` - Each interval has exactly two integer values. - `-10^9 <= start <= end <= 10^9`

Quick Answer: Practice a NVIDIA coding interview problem focused on merge overlapping time intervals. The prompt emphasizes edge cases, clean implementation, and verifiable test behavior without revealing the solution.

Merge overlapping or touching closed intervals and return the minimal sorted interval list.

Examples

Input: {"intervals": [[1,3],[2,6],[8,10],[10,12]]}

Expected Output: [[1,6],[8,12]]

Explanation: Overlapping and touching intervals are merged.

Input: {"intervals": []}

Expected Output: []

Explanation: Empty input.

Input: {"intervals": [[5,7]]}

Expected Output: [[5,7]]

Explanation: Single interval.

Input: {"intervals": [[5,7],[1,2],[2,4],[9,9]]}

Expected Output: [[1,4],[5,7],[9,9]]

Explanation: Unsorted input with touching intervals.

Input: {"intervals": [[1,1],[1,1],[2,2]]}

Expected Output: [[1,1],[2,2]]

Explanation: Duplicates.

Input: {"intervals": [[-5,-1],[-3,0],[2,3]]}

Expected Output: [[-5,0],[2,3]]

Explanation: Negative endpoints.

Input: {"intervals": [[1,4],[2,3]]}

Expected Output: [[1,4]]

Explanation: Contained interval.

Input: {"intervals": [[1,2],[3,4]]}

Expected Output: [[1,2],[3,4]]

Explanation: Separate intervals.

Last updated: Jul 4, 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
  • AI Coding 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

  • Compute the Final Robot Score - NVIDIA (easy)
  • Return all file paths via DFS - NVIDIA (easy)
  • Implement a disk space manager with eviction - NVIDIA (medium)
  • Implement short algorithms on logs, grids, and strings - NVIDIA (hard)
  • Implement encode/decode for list of strings - NVIDIA (easy)