← rippling Interview Insights

rippling·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jul 2026

Summary

Rippling software engineer round, one coding question the whole time. The problem looked straightforward but the edge cases around vote deduplication tripped me up more than I expected.

Questions Asked (1)

Q1

Design and implement a data structure to track users' upvotes and downvotes on articles. It needs a vote() method that handles duplicate votes correctly (same vote twice shouldn't create a new event, but flipping from up to down should), and a getLastVotes() method that returns the user's 3 most recent vote events in reverse chronological order.

Algorithms & Data StructuresSystem DesignData Modeling
Author's notes

I went straight for two hashmaps, one to track current vote state per user/article pair and one to store the event log per user.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify requirements and edge cases, then design a data structure that stores the current vote state per user-article pair and a per-user history of vote events. Implement vote() to update state and append to history only when the vote changes, and getLastVotes() to return the last 3 events in reverse chronological order.

Pro tip: Discuss trade-offs between memory and performance, and mention that in a real system you'd consider persistence, concurrency, and scalability—showing you think beyond the basic implementation.

1. Clarify Requirements and Edge Cases

Ask questions to confirm: what defines a vote event? Should duplicate votes be ignored? What about flipping votes? How many recent votes to return? Are there multiple articles per user?

2. Design Data Structures

Choose structures to track current vote state (e.g., a map from (user, article) to vote type) and per-user vote history (e.g., a map from user to a deque or list of events).

3. Implement vote() Method

On vote, check current state: if same as new vote, do nothing; if different or no previous vote, update state and append a new event to the user's history.

4. Implement getLastVotes() Method

Retrieve the user's history and return the last 3 events in reverse chronological order, handling cases with fewer than 3 events.

5. Analyze Complexity and Discuss Extensions

State time and space complexity, and mention potential improvements like persistence, concurrency, or scalability for production.

Key Points to Mention

  • Use a hash map to store current vote state per user-article pair for O(1) lookups.
  • Maintain a per-user list or deque of vote events to efficiently get recent votes.
  • Only record a new event when the vote changes (new vote or flip), not on duplicate votes.
  • For getLastVotes(), return the last 3 events in reverse order, possibly using a deque for O(1) access to the end.
  • Discuss time complexity: vote() is O(1), getLastVotes() is O(k) where k is the number of votes to return (3).
  • Consider edge cases: no votes, fewer than 3 votes, multiple articles, and concurrent votes.

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