PracHub
QuestionsLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Airbnb

Design a Stateful Working Hours Register

Last updated: Jul 28, 2026

Quick Overview

Design a stateful employee working-hours register that handles badge events, completed time, position rankings, delayed promotions, historical pay, and grant periods. The exercise tests validation, deterministic tie handling, interval boundaries, conflicting updates, scalability, and reproducible pay calculations.

  • hard
  • Airbnb
  • Software Engineering Fundamentals
  • Software Engineer

Design a Stateful Working Hours Register

Company: Airbnb

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: hard

Interview Round: Take-home Project

Design a working-hours register for employees who badge into and out of an office. Describe the data model, public operations, validation rules, and algorithms. You may use in-memory structures, but the design should make state transitions explicit and testable. ### Part 1: Attendance and Total Time Support adding an employee, recording alternating entry and exit badge events, and querying the employee's total completed working time. Define how duplicate employees, an exit without an open session, and an entry while already inside are handled. #### What This Part Should Cover - Employee identity and current inside/outside state - Completed sessions versus an open session - Clear invalid-operation behavior - Complexity of updates and total-time queries ### Part 2: Top Workers Return the top `n` employees for a position, ordered by completed working time. Define deterministic tie-breaking and explain whether open sessions count. #### What This Part Should Cover - Position-aware ranking - Stable tie-breaking - The cost of sorting on demand versus maintaining an index ### Part 3: Delayed Promotions and Historical Pay A promotion specifies a new position and compensation but takes effect only on the employee's next successful entry. Calculate pay over a time interval using the compensation attached to each completed session when that session began. #### What This Part Should Cover - Pending-promotion state and its activation point - Session-level compensation history - Interval overlap calculations - Repeated or conflicting promotion requests ### Part 4: Double-Pay Grant Periods Add grant periods. A completed session earns double pay only when the entire session lies within a grant period. Support querying both total pay and the portion attributable to the double-pay bonus. #### What This Part Should Cover - Boundary semantics for full containment - Overlapping or duplicate grant periods - Separation of base pay from bonus pay - Tests around exact boundaries and promotions ### What a Strong Answer Covers A strong answer uses one authoritative state transition for badge events, records enough history to reproduce pay, and avoids recomputing facts that can be accumulated safely. It states assumptions about timestamps, money, and incomplete sessions. ### Follow-up Questions - How would you persist the register and make badge events idempotent? - How would you support corrections to a historical event? - What indexing strategy would you use for millions of sessions and grant periods?

Quick Answer: Design a stateful employee working-hours register that handles badge events, completed time, position rankings, delayed promotions, historical pay, and grant periods. The exercise tests validation, deterministic tie handling, interval boundaries, conflicting updates, scalability, and reproducible pay calculations.

Related Interview Questions

  • Design a banking ledger for deposits/withdrawals - Airbnb (medium)
  • Design a Connect-Four-like board game - Airbnb (hard)
  • How do you conduct a code review exercise? - Airbnb (hard)
  • Design an extensible request Retryer - Airbnb (medium)
|Home/Software Engineering Fundamentals/Airbnb

Design a Stateful Working Hours Register

Airbnb logo
Airbnb
Jul 20, 2026, 12:00 AM
hardSoftware EngineerTake-home ProjectSoftware Engineering Fundamentals
6
0

Design a working-hours register for employees who badge into and out of an office. Describe the data model, public operations, validation rules, and algorithms. You may use in-memory structures, but the design should make state transitions explicit and testable.

Part 1: Attendance and Total Time

Support adding an employee, recording alternating entry and exit badge events, and querying the employee's total completed working time. Define how duplicate employees, an exit without an open session, and an entry while already inside are handled.

What This Part Should Cover Guidance

  • Employee identity and current inside/outside state
  • Completed sessions versus an open session
  • Clear invalid-operation behavior
  • Complexity of updates and total-time queries

Part 2: Top Workers

Return the top n employees for a position, ordered by completed working time. Define deterministic tie-breaking and explain whether open sessions count.

What This Part Should Cover Guidance

  • Position-aware ranking
  • Stable tie-breaking
  • The cost of sorting on demand versus maintaining an index

Part 3: Delayed Promotions and Historical Pay

A promotion specifies a new position and compensation but takes effect only on the employee's next successful entry. Calculate pay over a time interval using the compensation attached to each completed session when that session began.

What This Part Should Cover Guidance

  • Pending-promotion state and its activation point
  • Session-level compensation history
  • Interval overlap calculations
  • Repeated or conflicting promotion requests

Part 4: Double-Pay Grant Periods

Add grant periods. A completed session earns double pay only when the entire session lies within a grant period. Support querying both total pay and the portion attributable to the double-pay bonus.

What This Part Should Cover Guidance

  • Boundary semantics for full containment
  • Overlapping or duplicate grant periods
  • Separation of base pay from bonus pay
  • Tests around exact boundaries and promotions

What a Strong Answer Covers Guidance

A strong answer uses one authoritative state transition for badge events, records enough history to reproduce pay, and avoids recomputing facts that can be accumulated safely. It states assumptions about timestamps, money, and incomplete sessions.

Follow-up Questions Guidance

  • How would you persist the register and make badge events idempotent?
  • How would you support corrections to a historical event?
  • What indexing strategy would you use for millions of sessions and grant periods?
Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Airbnb•More Software Engineer•Airbnb Software Engineer•Airbnb Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.