FastPrepWorker Management, Part 4: Double-Paid Intervals
Problems/Worker Management, Part 4: Double-Paid Intervals

Worker Management, Part 4: Double-Paid Intervals

Anthropic logoAnthropic● HardOA
QuestionFunctionExamples

Problem statement

Source note: The report preserved this final level through a stated 1000/1000 implementation and a second Anthropic report. The exact original Level 4 screenshot was not available; the deterministic interval behavior below is the portion supported by both reports.

Continue the worker management system from Part 3. Existing worker, session, promotion, ranking, and salary operations keep their behavior.

Double-Paid Time

  • ["SET_DOUBLE_PAID", start_timestamp, end_timestamp]: register the half-open interval [start_timestamp, end_timestamp) as double-paid time and return an empty string.
  • Double-paid intervals apply globally to every worker.
  • Merge overlapping intervals. Time covered by multiple registered intervals is still paid at most twice, never three or more times.
  • CALC_SALARY first pays normal compensation for completed-session time, then adds one extra copy of compensation for the portion inside double-paid intervals.

Function

workerManagementLevel4(operations: String[][]) → String[]

Examples

Example 1

operations = [["ADD_WORKER","Alice","Engineer","100"],["REGISTER","Alice","10"],["REGISTER","Alice","30"],["SET_DOUBLE_PAID","15","25"],["CALC_SALARY","Alice","0","40"],["SET_DOUBLE_PAID","20","35"],["CALC_SALARY","Alice","0","40"]]return = ["true","registered","registered","","3000","","3500"]

Alice's completed session pays 20*100 = 2000 normally. The first double-paid interval overlaps it for 10 units, producing 3000. After merging [15,25) with [20,35), the session has 15 double-paid units, producing 3500.

More Anthropic problems

  • Fair Coin from a Biased CoinPHONE SCREEN · Seen Nov 2026
  • Crawl Same-Hostname URLs ConcurrentlyPHONE SCREEN · Seen Oct 2026
  • Longest-Match Tokenizer with Unknown SymbolsONSITE INTERVIEW · Seen Oct 2026
All Anthropic interview questionsSee Anthropic hiring insights
Saved
class Solution {
    public String[] workerManagementLevel4(String[][] operations) {
      // write your code here
    }

}
Checking account…