← Meta Interview Insights

Meta·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
Jun 2026

Summary

Meta system design interview, level 3 of 4 in some kind of integrated assessment. The problem was extending a work hours tracking system with promotion logic and salary computation. Fairly involved for a single question.

Questions Asked (1)

Q1

You have an existing work hours registration system. Extend it with two features: a promote() method that registers a promotion for a worker with a new position and hourly rate (where the new rate only kicks in after the current session ends), and a calc_salary() method that computes total earnings for a worker over a given time range by summing up the overlap of each completed session with that range, using the rate that was in effect at session start.

System DesignAPI & IntegrationsAlgorithms & Data Structures
Author's notes

The delayed promotion part tripped me up more than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the existing system's data model and session lifecycle, then design the promote() and calc_salary() methods to handle rate changes and time-range calculations correctly. Emphasize edge cases like overlapping sessions, rate changes mid-session, and boundary conditions in the time range.

Pro tip: Discuss how you would handle rate changes that occur during an active session—since the new rate only applies after the session ends, you need to store the rate at session start and use that for the entire session. Also, consider using an interval tree or sorted list for efficient overlap queries if the number of sessions is large.

1. Clarify requirements and assumptions

Ask about the existing system's data structures, how sessions are stored, and whether promotions can be scheduled or only applied immediately. Confirm that calc_salary() sums earnings from completed sessions only.

2. Design data model for promotions

Propose storing a worker's current rate and a pending rate (if promotion is scheduled). For promote(), update the pending rate and position, ensuring the new rate applies only after the current session ends.

3. Implement calc_salary() with overlap logic

For each completed session, compute the overlap duration with the given time range, multiply by the rate at session start, and sum. Handle sessions that partially overlap the range.

4. Address edge cases and efficiency

Consider sessions that start before the range, end after the range, or are fully contained. Discuss time complexity and potential optimizations like sorting sessions or using interval trees.

5. Test and validate

Walk through examples: a promotion mid-range, multiple sessions with different rates, and boundary cases (e.g., session exactly at range start/end). Verify calculations.

Key Points to Mention

  • Rate at session start is used for the entire session, even if a promotion occurs during it.
  • Promote() should update the worker's rate only after the current session ends, so store a pending rate.
  • Calc_salary() must sum earnings from completed sessions only, ignoring ongoing sessions.
  • Overlap calculation: max(0, min(session_end, range_end) - max(session_start, range_start)).
  • Efficiency: if many sessions, consider sorting sessions by start time and using binary search or interval tree for overlap queries.
  • Edge cases: sessions spanning range boundaries, promotions during a session, and zero-duration overlaps.

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