Reported July 2026
Airbnbdesign

Worker Management, Part 3: Promotions and Salary

Reported by candidates from Airbnb's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Airbnb OA. Under 2s to a working solution.
Founder's read

The Airbnb OA reported in July 2026 is Part 3 of the worker management series, and the whole thing hinges on one data structure: a per-worker list of sessions, each stamped with the position and compensation that were active when it began. Get that right and CALC_SALARY is a clean interval-overlap sum. Get it wrong and you'll fight off-by-one bugs on the half-open range for an hour. You've already built Parts 1 and 2, so this is an extension, not a rewrite. If you blank on the promotion timing rule during the live assessment, StealthCoder is the quiet safety net running invisibly on your screen.

The problem

Continue the worker management system from Parts 1 and 2. Existing operations keep their behavior.
Promotions
["PROMOTE", worker_id, new_position, new_compensation, start_timestamp]: register a pending promotion. Return success, or invalid_request if the worker is missing or already has an unapplied promotion.
The promotion becomes active when the worker first enters the office at a timestamp greater than or equal to start_timestamp. A session that begins earlier keeps the previous position and compensation.
TOP_N_WORKERS considers only each worker's current position. GET continues to sum completed time across every past and current position.
Salary
["CALC_SALARY", worker_id, start_timestamp, end_timestamp]: return the salary earned during the half-open interval [start_timestamp, end_timestamp).
Only completed office sessions are paid. For each session, multiply the length of its intersection with the requested interval by the compensation active for that session.
Return an empty string for a missing worker.

Function
workerManagementLevel3(operations: String[][]) → String[]

Examples
Example 1
operations = [["ADD_WORKER","John","Middle Developer","200"],["REGISTER","John","100"],["REGISTER","John","125"],["PROMOTE","John","Senior Developer","500","200"],["REGISTER","John","150"],["PROMOTE","John","Senior Developer","350","250"],["REGISTER","John","300"],["REGISTER","John","325"],["CALC_SALARY","John","0","500"],["TOP_N_WORKERS","3","Senior Developer"],["REGISTER","John","400"],["GET","John"],["TOP_N_WORKERS","10","Senior Developer"],["TOP_N_WORKERS","10","Middle Developer"],["CALC_SALARY","John","110","350"]]
return = ["true","registered","registered","success","registered","invalid_request","registered","registered","35000","John(0)","registered","250","John(75)","","45500"]
The session beginning at 150 keeps the old compensation because it starts before 200. The promotion applies when John next enters at 325. Salary over [110,350) is 15*200 + 150*200 + 25*500 = 45500.

Reported by candidates. Source: FastPrep

Pattern and pitfall

Store for each worker a current position and compensation, one pending promotion (or none), and a list of completed sessions as (start, end, compensation). On every REGISTER that is an entry, check the pending promotion: if the entry timestamp is >= start_timestamp, apply it now, then record the session's compensation from that moment. The trap is applying the promotion at start_timestamp instead of at the next entry. Example 1 shows it: the session starting at 150 keeps the old pay, and the promotion only lands at 325. For CALC_SALARY, loop the completed sessions, compute max(0, min(end, hi) - max(start, lo)), multiply by that session's compensation, and sum. Skip open sessions. Return an empty string for a missing worker. A second PROMOTE while one is pending returns invalid_request. TOP_N_WORKERS filters on the current position only, while GET sums across all positions. StealthCoder is your hedge if the state bookkeeping gets tangled live.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Worker Management, Part 3: Promotions and Salary cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Airbnb's OA.

Airbnb reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Worker Management, Part 3: Promotions and Salary FAQ

What's the trick in Worker Management Part 3?+

Snapshot the compensation onto each session when it starts. Promotions are pending until the worker's next entry at or after start_timestamp, so pay is decided at entry time, not at the promotion time. That makes salary calculation a simple overlap sum.

How do I compute CALC_SALARY correctly?+

For each completed session, take max(0, min(sessionEnd, intervalEnd) - max(sessionStart, intervalStart)) and multiply by that session's stored compensation. Sum the results. Ignore any session still open. The half-open interval means the end timestamp isn't counted.

When exactly does a promotion apply?+

At the worker's first entry with a timestamp greater than or equal to start_timestamp. A session that began before that keeps the old position and pay, even if it runs past start_timestamp. In the example, the entry at 150 stays old and the entry at 325 gets the promotion.

Do TOP_N_WORKERS and GET change after promotions?+

Yes, differently. TOP_N_WORKERS only looks at each worker's current position, so a promoted worker leaves the old position's list. GET still sums completed time across every past and current position, so keep total time separate from position.

How do I prepare for this in 48 hours?+

Re-run Parts 1 and 2 from memory, then add the pending-promotion field and per-session compensation. Trace Example 1 by hand, especially the 45500 result. Test edge cases: a duplicate PROMOTE, a missing worker, and an interval that cuts a session in half.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Airbnb.

OA at Airbnb?
Invisible during screen share
Get it