← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Meta SWE interview built around a multi-level system design and implementation problem called WorkHoursRegister. Four progressively harder levels stacked on top of each other, each one adding enough complexity that you really couldn't fake your way through with a half-baked data model from the start.

Questions Asked (4)

Q1

Design and implement a WorkHoursRegister system that supports adding workers with an hourly rate, toggling entry/exit via timestamps, and querying a worker's total completed work time.

System DesignAlgorithms & Data StructuresData Modeling
Author's notes

The toggle mechanic tripped me up more than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design a clean data model with Worker and TimeEntry classes. Implement toggle logic using a stack or state flag, and compute total time by summing completed intervals, handling edge cases like open sessions and duplicate toggles.

Pro tip: Mention that you would use a monotonic clock or server-side timestamps to avoid issues with client clock skew, and discuss how to handle concurrent toggles with locking or optimistic concurrency.

1. Clarify Requirements

Ask about expected scale, persistence needs, concurrency, and whether timestamps are provided or generated. Confirm if multiple workers can be active simultaneously and if breaks are allowed.

2. Design Data Model

Define a Worker class with id, hourlyRate, and a list of completed intervals (start, end). Optionally maintain an open interval for the current session. Use a map from workerId to Worker for O(1) lookup.

3. Implement Toggle Logic

On toggle, if no open interval, start one with the given timestamp; if an open interval exists, close it and add to completed intervals. Validate that end > start and handle duplicate toggles gracefully.

4. Compute Total Work Time

Sum durations of all completed intervals. If an open interval exists, optionally include time up to now or exclude it based on requirements. Return total in hours or seconds.

5. Discuss Edge Cases and Extensions

Cover scenarios like toggling without prior entry, overlapping intervals, clock changes, and persistence. Mention how to extend for reporting, overtime, or multiple concurrent sessions.

Key Points to Mention

  • Use of appropriate data structures (e.g., list of intervals, map for workers) for efficient operations.
  • Handling of open sessions and ensuring total time only counts completed intervals unless specified otherwise.
  • Time complexity: O(1) for toggle and add worker, O(n) for total time where n is number of intervals.
  • Concurrency considerations: thread safety, locking, or optimistic concurrency for toggles.
  • Validation: ensuring timestamps are monotonic and end time is after start time.
  • Extensibility: how to add features like breaks, overtime, or reporting without major refactoring.

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

Q2

Extend the system to return the top N workers by total hours worked, filtered by position, with ties broken alphabetically by worker ID.

Algorithms & Data StructuresData Modeling
Author's notes

Pretty mechanical once your data model is clean.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the input data model and constraints, then propose an efficient algorithm using a hash map to aggregate hours per worker and a heap or sorting to select top N with tie-breaking. Discuss trade-offs between sorting all workers versus maintaining a min-heap of size N, and how to handle filtering by position.

Pro tip: Mention that tie-breaking alphabetically by worker ID can be handled by including the ID in the comparison key, and consider whether the position filter can be applied early to reduce the dataset. Also, discuss how to handle ties at the cutoff (e.g., if multiple workers have the same hours, the alphabetical order determines who makes the top N).

1. Clarify requirements and constraints

Ask about the size of the dataset, whether the data is static or streaming, and if the position filter is exact match or partial. Confirm the definition of 'total hours worked' and how ties should be broken.

2. Design data aggregation

Propose using a hash map to accumulate total hours per worker, filtering by position as you iterate. Discuss whether to store worker details (like position) in the map or filter beforehand.

3. Select top N with tie-breaking

Explain how to efficiently get the top N workers. Options: sort all filtered workers by (hours descending, worker ID ascending) and take first N, or use a min-heap of size N with a custom comparator that considers both hours and ID.

4. Analyze complexity and trade-offs

Compare time and space complexity of sorting (O(M log M)) versus heap (O(M log N)), where M is number of filtered workers. Discuss when each is preferable based on N relative to M.

5. Handle edge cases and extensions

Address cases like fewer than N workers, ties at the boundary, and potential updates if data changes. Mention how to extend to streaming data or distributed processing if needed.

Key Points to Mention

  • Hash map for aggregation: key by worker ID, sum hours, and store position for filtering.
  • Comparator design: sort by total hours descending, then worker ID ascending for tie-breaking.
  • Min-heap of size N: maintain top N efficiently, with custom comparator to handle ties correctly.
  • Time complexity: O(M log M) for sorting vs O(M log N) for heap, where M is number of workers after filtering.
  • Space complexity: O(M) for hash map and O(N) for heap, or O(M) for sorting.
  • Edge cases: fewer than N workers, ties at cutoff, and handling of workers with zero hours.

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

Q3

Add a promotion feature where a worker's new position and pay rate are stored but only take effect starting from their next clock-in, then implement a salary calculator that computes pay across a date range by applying the correct rate to each completed session.

System DesignData ModelingAlgorithms & Data Structures
Author's notes

This is where the earlier data model decision really matters.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then design a data model that separates scheduled promotions from active worker state. Implement the promotion logic to apply at the next clock-in, and build the salary calculator by iterating over completed sessions and applying the correct rate based on effective dates.

Pro tip: Mention that promotions should be stored as future-dated records and applied atomically during clock-in to avoid race conditions. Also, consider edge cases like overlapping promotions, retroactive changes, and timezone handling.

1. Clarify Requirements

Ask about promotion scheduling, effective date rules, and whether multiple promotions can be pending. Confirm that pay rate changes only apply to sessions started after the promotion takes effect.

2. Design Data Model

Propose tables for workers, promotions (with effective_date and applied flag), and work_sessions (with start_time, end_time, and rate_applied). Ensure promotions are linked to workers and store new position and pay rate.

3. Implement Promotion Application

On clock-in, check for any pending promotions with effective_date <= current time. If found, update the worker's current position and pay rate, mark the promotion as applied, and record the rate for the new session.

4. Build Salary Calculator

Given a date range, fetch all completed sessions that overlap the range. For each session, compute the payable duration (clipped to range) and multiply by the session's rate. Sum the results.

5. Handle Edge Cases

Discuss handling of sessions spanning multiple rates (if rate changes mid-session), timezone conversions, and retroactive promotions. Ensure the calculator uses the rate stored per session for accuracy.

Key Points to Mention

  • Separation of scheduled promotions from active worker state to ensure changes apply only at next clock-in.
  • Atomicity and concurrency: use transactions or locks when applying promotions during clock-in to prevent race conditions.
  • Storing the applied rate per work session to simplify salary calculation and avoid recomputing historical rates.
  • Efficient querying for salary calculation: index on worker_id and session start/end times, and consider pagination for large date ranges.
  • Handling of edge cases: promotions effective mid-session, timezone differences, and retroactive adjustments.
  • Scalability: consider how the design handles many workers and sessions, and whether to precompute or cache salary data.

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

Q4

Add grant periods where any worker session fully contained within a registered grant window is paid at double rate, and implement a method to retrieve the total extra bonus paid across all workers under a specific grant.

System DesignData ModelingTechnical Trade-offs
Author's notes

The 'fully contained' condition is a gotcha.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the data model and semantics first: define grant windows, worker sessions, and the containment rule. Then design a solution that efficiently identifies fully contained sessions and computes the extra bonus per grant, considering scale and correctness. Finally, discuss trade-offs between different implementation strategies (e.g., precomputation vs. on-the-fly) and how to retrieve the total extra bonus for a specific grant.

Pro tip: Emphasize the importance of indexing and query optimization for large datasets, and mention that you would validate the containment logic with edge cases like sessions exactly matching grant boundaries.

1. Clarify requirements and data model

Ask questions to understand the definitions of grant windows, worker sessions, and what 'fully contained' means (inclusive/exclusive boundaries). Confirm the expected scale and access patterns.

2. Design the data schema and indexing strategy

Propose tables/collections for grants and sessions, with appropriate indexes on time ranges and worker IDs to support efficient containment checks and aggregation.

3. Implement containment detection and bonus calculation

Outline an algorithm to identify sessions fully within a grant window, compute the extra bonus (e.g., double rate means extra = base rate * duration), and store or aggregate it per grant.

4. Implement retrieval method for total extra bonus per grant

Design a method (e.g., SQL query or API endpoint) that sums the extra bonus for all workers under a specific grant, ensuring it leverages indexes and is efficient.

5. Discuss trade-offs and scalability

Compare precomputing bonuses at write time vs. calculating on read, and discuss how to handle large volumes, concurrency, and potential data consistency issues.

Key Points to Mention

  • Definition of containment: session start >= grant start AND session end <= grant end, with boundary inclusivity clarified.
  • Indexing strategies: composite indexes on (grant_id, start_time, end_time) or range indexes for efficient overlap/containment queries.
  • Bonus calculation: extra bonus = base rate * session duration (since double rate means extra = base rate * duration).
  • Aggregation method: use SQL SUM with GROUP BY grant_id or maintain a running total in a separate table for fast retrieval.
  • Trade-offs: precomputation reduces read latency but adds write overhead and complexity; on-the-fly computation is simpler but may be slower for large data.
  • Edge cases: sessions exactly matching grant boundaries, overlapping grants, and sessions that span multiple grants (though containment requires full containment within one grant).

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