← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

Meta SWE interview with a multi-level OOP/design problem. Level 1 was about building a work hours tracking system, which sounds straightforward but has a few subtle edge cases worth thinking through carefully.

Questions Asked (1)

Q1

Design and implement Level 1 of a WorkHoursRegister system that tracks when workers enter and exit an office. You need to support adding workers with an ID, position, and hourly compensation; a register call that toggles their in/out status and records completed sessions; and a get call that returns total accumulated work time from completed sessions only.

System DesignAPI & IntegrationsData Modeling
Author's notes

The toggle mechanic is where I had to slow down.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the core data model, then design a clean API with clear state transitions. Implement the solution with attention to edge cases and data integrity, and finally discuss potential extensions and trade-offs.

Pro tip: Explicitly handle edge cases like duplicate register calls or registering a worker who doesn't exist, and mention how you'd test them. This shows production-level thinking beyond basic functionality.

1. Clarify Requirements and Constraints

Ask questions to confirm assumptions: Is the register call idempotent? Can a worker have multiple sessions? What happens if register is called when already in/out? This ensures you build the right thing.

2. Design Data Model

Define entities: Worker (id, position, hourlyCompensation) and Session (startTime, endTime). Decide on storage (in-memory map for Level 1) and how to track current status (e.g., a boolean or nullable startTime).

3. Define API and State Transitions

Specify methods: addWorker(id, position, hourlyCompensation), register(id) toggles status and records session, get(id) returns total completed work time. Clearly describe state changes: when register is called, if worker is out, start session; if in, end session and add duration to total.

4. Implement Core Logic

Write code (or pseudocode) for the data structures and methods, ensuring correct handling of edge cases: worker not found, register when already in/out, and only counting completed sessions in get.

5. Test and Discuss Extensions

Walk through test scenarios (e.g., multiple sessions, toggling) and mention potential improvements like persistence, concurrency, or time zones for Level 2+.

Key Points to Mention

  • Data model: Worker with id, position, hourlyCompensation; Session with start and end times; total accumulated time stored per worker.
  • State management: Use a flag or nullable start time to track if worker is currently in; register toggles state and creates/ends sessions.
  • API design: addWorker, register, get methods with clear contracts and error handling (e.g., throw exception if worker not found).
  • Edge cases: Duplicate register calls, registering non-existent worker, get for worker with no completed sessions, and ensuring only completed sessions count.
  • Time calculation: Sum durations of completed sessions; consider using timestamps and calculating difference in appropriate units (e.g., hours).
  • Testing: Unit tests for adding workers, toggling, multiple sessions, and edge cases; mention mocking time for deterministic tests.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.