Maximize Billable Value From Client Projects With Bench Cooldown
Last updated: November 29, 2026
Quick Overview
An engineer can take client projects given as (start_day, end_day, value) with inclusive days, one at a time, and must spend k bench days between projects; choose a subset maximizing total value.
Infosys
November 29, 20260
0
0 solved
An engineer can take client projects given as (start_day, end_day, value) with inclusive days, one at a time, and must spend k bench days between projects; choose a subset maximizing total value.
This mirrors the harder dynamic programming problems on the Infosys Specialist Programmer track, set in the services world of allocation and billable utilization. The grader expects weighted interval scheduling with a binary search predecessor and an exact treatment of the cooldown boundary.
What the Interviewer Expects
- Recognize weighted interval scheduling and why greedy by end time fails
- Sort by end day and define dp over prefixes
- Find the compatible predecessor with binary search using end <= start - k - 1
- Reach O(n log n) time
- Get the inclusive-day and cooldown off-by-one right
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 reconstruct which projects were chosen?
- What if the engineer can run at most two projects in parallel?
- How does the solution change if value depends on how many days the engineer is actually allocated?
- If there are m engineers and you want to maximize total value across the team, what is the hardness and what would you do in practice?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
n up to about projects, each (s, e, v) with s <= e, days inclusive. After a project ending on day e, the next can start on day e + k + 1 at the earliest. Return the maximum total value; p...
High-Level Design
Greedy by value or earliest end fails because one valuable long project can beat two short ones. Sort by end day. Let dp[i] be the best value using only the first i projects. Project i is either ski...