Total Time a Backup Node Spends Running Overlapping Jobs

Last updated: November 29, 2026

Quick Overview

Given the start and end times of every backup job that ran on one cluster node during a day, return the total time the node had at least one job running.

Rubrik
Coding & Algorithms
Software Engineer
Rubrik
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given the start and end times of every backup job that ran on one cluster node during a day, return the total time the node had at least one job running.

A warm-up in the style of a Rubrik phone screen, framed around how busy a CDM node is during its backup window. The interviewer checks that you reach for sort-and-merge, handle touching intervals deliberately, and write clean code fast.

What the Interviewer Expects
  • Sort by start time and merge in one pass
  • Decide explicitly whether touching intervals merge
  • Return 0 for empty input
  • State O(n log n) time and O(1) extra space beyond the sort
  • Test with nested and disjoint intervals
Key Topics to Cover
interval merging
sorting
backup windows
sweep line
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you return the idle gaps longer than 30 minutes, where an admin could schedule maintenance?
  • Jobs now arrive as a live stream in time order. How do you keep the running total?
  • How would you find the peak number of concurrent jobs instead?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input is a list of (start, end) pairs with start < end, in any order. Output is the length of their union. Intervals that touch (end == next start) can merge with no effect on the total, so eith...

High-Level Design

Sort by start. Walk the list keeping one open block [cur_s, cur_e]. If the next job starts before the block ends, extend the block; otherwise add the block's length to the total and open a new one....


Submit Your Answer
Markdown supported

Related Questions