Maximize Billable Hours Without Back-to-Back Client Engagements
Last updated: November 29, 2026
Quick Overview
An IBM Consulting practitioner is offered a sequence of weekly engagements with given billable hours, but cannot take two consecutive weeks; return the maximum total billable hours.
IBM
November 29, 20260
0
0 solved
An IBM Consulting practitioner is offered a sequence of weekly engagements with given billable hours, but cannot take two consecutive weeks; return the maximum total billable hours.
IBM's HackerRank-style online assessments frequently include a classic one-dimensional DP dressed in a business story, here IBM Consulting staffing. The grader checks the recurrence, constant-space implementation, and correct handling of very short inputs.
What the Interviewer Expects
- State the recurrence take or skip
- Identify base cases for zero and one week
- Reduce space to O(1)
- Trace a small example
- Optionally recover which weeks were chosen
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 the chosen weeks, not just the total?
- What if the weeks form a cycle, so the first and last are adjacent?
- What if the rule is at least two free weeks between engagements?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: list hours of non-negative integers, one per week. Output: the maximum sum of a subset with no two adjacent indices. Empty input returns 0. Before coding, confirm with the interviewer that ho...
High-Level Design
Let best[i] be the best total using weeks 0..i. For week i either skip it, keeping best[i-1], or take it, earning hours[i] + best[i-2]. The answer is best[n-1]. Since each state only looks...