Compute Daily Overlap Hours Between a Remote Developer and Client

Last updated: November 29, 2026

Quick Overview

Each person has a local working window (start hour, end hour) and a UTC offset that may be fractional; windows may cross midnight. Return the number of hours per day both are working at the same time.

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

0

0

0 solved


Each person has a local working window (start hour, end hour) and a UTC offset that may be fractional; windows may cross midnight. Return the number of hours per day both are working at the same time.

Turing matches remote developers around the world with US and European companies, and timezone overlap is a hard constraint in that matching. The interviewer checks careful interval reasoning with modular arithmetic and wraparound rather than a clever algorithm.

What the Interviewer Expects
  • Converts both windows into the same reference timezone
  • Handles windows that wrap past midnight by splitting them
  • Supports half-hour offsets such as India
  • Computes overlap of half-open intervals correctly
  • Tests with at least one wrap case
Key Topics to Cover
Intervals
Modular arithmetic
Timezones
Edge cases
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 handle daylight saving time changes for a weekly schedule?
  • How would you return the actual overlapping UTC intervals instead of just the total?
  • Given 10,000 developers and one client, how would you rank developers by overlap quickly?
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

Each input is (local_start, local_end, utc_offset) with hours in [0, 24]. A window is half-open, so 9 to 17 means 8 hours. If local_end < local_start, the shift crosses local midnight. A window of...

High-Level Design

Map each window to UTC by subtracting the offset and taking it modulo 24. After mapping, a window is either one segment [s, e) or, if it wraps, two segments [s, 24) and [0, e). Then sum the pair...


Submit Your Answer
Markdown supported

Related Questions