← Ramp Interview Insights

Ramp·Software Engineer·Technical Phone Screen·Senior

Senior
May 2026

Summary

Ramp SWE interview that went deep on a custom task scheduler design, specifically around adding completion tracking and overdue detection to an already-complex system. The design space was bigger than it looked at first glance.

Questions Asked (3)

Q1

You're given a task scheduler with add, update, get, search, and list operations, plus user quotas and time-based task assignment. How would you add a complete_task operation that marks an active assignment as done, frees up the user's quota slot immediately, and returns false if the assignment doesn't exist or isn't currently active?

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

The quota-freeing part is what tripped me up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the data model and concurrency requirements, then outline the complete_task operation's contract: validate assignment existence and active status, atomically update state, and release the quota slot. Emphasize idempotency, thread-safety, and consistency between assignment status and quota accounting.

Pro tip: Discuss how you would handle race conditions—e.g., using locks or compare-and-swap—to ensure the quota is freed exactly once, and mention that returning false for non-existent or inactive assignments prevents double-freeing and maintains data integrity.

1. Clarify requirements and assumptions

Ask about concurrency expectations, persistence, and whether assignments can be shared. Confirm that 'active' means not completed or cancelled, and that quota is per-user.

2. Design the data model

Define an Assignment entity with fields like id, userId, status (active/completed), and timestamps. Ensure the scheduler maintains a mapping from assignment to user and a quota counter per user.

3. Outline the complete_task algorithm

Look up the assignment by ID; if missing or not active, return false. Otherwise, atomically set status to completed, decrement the user's active assignment count, and return true.

4. Address concurrency and atomicity

Use locks, transactions, or atomic operations to prevent race conditions where two complete_task calls could both succeed and double-decrement quota. Consider optimistic concurrency with versioning.

5. Discuss edge cases and integration

Handle cases like completing an already completed assignment, quota overflow/underflow, and how this operation interacts with update and search. Mention logging and metrics for observability.

Key Points to Mention

  • Idempotency: repeated calls to complete_task should not double-free quota or change state after first success.
  • Atomicity and concurrency control: use locks or compare-and-swap to ensure status update and quota decrement happen atomically.
  • Quota management: decrement the user's active assignment count immediately upon completion, and ensure it never goes negative.
  • Return value semantics: return false for non-existent or inactive assignments, true only on successful completion.
  • Data consistency: keep assignment status and quota counter in sync, possibly using a transaction or event-driven update.
  • Observability: log completion events and emit metrics for monitoring quota usage and task completion rates.

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

Q2

How would you implement get_overdue_assignments(timestamp, user_id) to return all task IDs for a user where the finish time has passed and the task was never completed before that deadline? How do you make this efficient?

System DesignAlgorithms & Data StructuresData Modeling
Author's notes

I went straight to a linear scan over all assignments and the interviewer pushed back pretty fast.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the data model and semantics first, then propose an efficient query using appropriate indexes and possibly denormalization. Discuss trade-offs between read-time computation and write-time maintenance, and how to scale for large datasets.

Pro tip: Mention that you would use a partial index on (user_id, due_date) WHERE completed_at IS NULL to make the query fast, and consider a materialized view or background job if the query is frequent.

1. Clarify requirements and data model

Ask about the schema: how tasks, assignments, and completions are stored. Confirm that 'finish time' means due date and that 'never completed before that deadline' means completed_at is null or > due_date.

2. Design the query

Write a SQL query that selects task IDs from assignments where user_id = ? and due_date < ? and (completed_at is null or completed_at > due_date).

3. Optimize with indexes

Propose a composite index on (user_id, due_date) and a partial index for incomplete tasks. Discuss covering indexes to avoid table lookups.

4. Consider scalability and alternatives

If the query is frequent, suggest denormalizing overdue tasks into a separate table or using a background job to precompute results. Discuss caching and read replicas.

5. Address edge cases and testing

Mention handling of null due dates, time zones, and tasks completed exactly at the deadline. Suggest unit tests and performance testing.

Key Points to Mention

  • Composite index on (user_id, due_date) for efficient filtering
  • Partial index on incomplete tasks to reduce index size
  • Avoiding full table scans by using indexed columns
  • Trade-offs between read-time computation and write-time maintenance
  • Use of materialized views or background jobs for frequent queries
  • Handling of time zones and null values in due dates

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

Q3

How does the assignment state model work across the full lifecycle? Walk through how you'd represent pending, completed, and overdue states, and how get_user_tasks should behave given that overdue assignments are neither active nor completed.

System DesignTechnical Trade-offsData Modeling
Author's notes

This is where I got a little lost.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and defining the state model as a finite set of states with explicit transitions, then discuss how to represent derived states like overdue. Walk through the lifecycle from creation to completion, explaining how get_user_tasks should filter and return tasks based on the requested view (active, completed, overdue) and how to handle the fact that overdue is neither active nor completed. Emphasize trade-offs between storing state vs. computing it, and how to ensure consistency and performance.

Pro tip: Mention that overdue is a derived state based on due date and completion status, so it shouldn't be stored as a primary state to avoid stale data. Instead, compute it dynamically or via a scheduled job, and ensure get_user_tasks accepts a filter parameter to return the appropriate subset.

1. Clarify requirements and scope

Ask questions to understand what states are needed, how tasks are assigned, and what get_user_tasks is expected to return. Confirm whether overdue is a separate state or a derived condition.

2. Define the state model and transitions

Propose a finite state machine with states like pending, completed, and possibly expired/cancelled. Define allowed transitions (e.g., pending -> completed, pending -> overdue) and how overdue is determined (due date passed and not completed).

3. Represent states in the data model

Suggest storing a status field for primary states (pending, completed) and a due_date field. Overdue is computed as status == pending AND due_date < now. Discuss trade-offs of materializing overdue vs. computing on the fly.

4. Design get_user_tasks behavior

Explain that get_user_tasks should accept parameters like user_id and a filter (e.g., view='active', 'completed', 'overdue'). For 'active', return pending tasks that are not overdue; for 'overdue', return pending tasks past due; for 'completed', return completed tasks. Ensure the query is efficient with proper indexing.

5. Address edge cases and trade-offs

Discuss handling time zones, clock skew, and how to update overdue status (e.g., via cron job or on-read). Mention consistency concerns if materializing overdue and how to avoid race conditions.

Key Points to Mention

  • Overdue is a derived state, not a primary state; compute it based on due date and completion status.
  • Use a status enum for primary states (e.g., PENDING, COMPLETED) and a separate due_date field.
  • get_user_tasks should support filtering by view (active, completed, overdue) and return appropriate tasks.
  • Active tasks are pending and not overdue; overdue tasks are pending and past due; completed tasks are done.
  • Consider performance: index on (user_id, status, due_date) for efficient queries.
  • Trade-offs: materializing overdue for faster reads vs. computing on the fly for consistency.

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