Earliest Bookable Job Slot With Travel Buffers
Last updated: November 29, 2026
Quick Overview
Given a pro's busy blocks, the customer's available windows, a job duration and a travel buffer that must surround every existing booking, return the earliest start time in the day where the job fits, or None.
Thumbtack
November 29, 20260
0
0 solved
Given a pro's busy blocks, the customer's available windows, a job duration and a travel buffer that must surround every existing booking, return the earliest start time in the day where the job fits, or None.
Thumbtack lets customers book some pros directly against their calendar, which needs a correct availability calculation. The interviewer checks interval merging, two-pointer intersection and careful boundary handling.
What the Interviewer Expects
- Clarifies time units, inclusive or exclusive ends, and day bounds
- Inflates busy blocks by the buffer and clips to the working day
- Merges overlapping inflated blocks before computing free gaps
- Intersects free gaps with customer windows using two pointers
- Returns the earliest feasible start, not just any
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you return all feasible starts on a 15 minute grid?
- Travel time depends on the distance between consecutive jobs. How does the model change?
- How would you handle a multi-day job or recurring cleaning visits?
- How do you prevent two customers booking the same slot at the same moment?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Times are minutes since midnight. busy is a list of (start, end) bookings, possibly overlapping and unsorted. customer_windows are (start, end) times the customer is home. The pro works `day_start...
High-Level Design
- Inflate each busy block to (s - buffer, e + buffer), clipped to the day.
- Sort and merge overlapping blocks.
- Complement inside the day to get free gaps.
- Two-pointer intersect the sorted fre...