Article Vote Tracker
Reported by candidates from Rippling's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The Rippling OA reported in July 2026 hands you a vote tracker where the whole question hides in one phrase: a flip isn't a repeated vote. Casting the same vote twice does nothing, and a first vote on an article doesn't count either. It's a design problem dressed up as a string-array parser. You need a per-user vote state and a recency-ordered list of flipped articles. If you blank on the structure mid-assessment, StealthCoder sits invisible on your screen and gives you a working solution as a safety net.
The problem
Build an in-memory vote-management service for an online news platform. Users may upvote or downvote published articles, and the service tracks the articles on which each user most recently changed their vote. Process the operations in order and return one row for each operation that produces output. Operations ["ADD", articleName]: add an article. Article IDs start at 1 and increase by one. Return the assigned ID as a one-element row. ["UPVOTE", articleId, userId]: record an upvote. The article ID is valid, and any user ID is allowed. ["DOWNVOTE", articleId, userId]: record a downvote. The article ID is valid, and any user ID is allowed. ["LAST_THREE", userId]: return the titles of the last three distinct articles on which the user flipped their vote from upvote to downvote or from downvote to upvote. Return the most recent title first. Casting the same vote repeatedly is not a flip. If a user flips the same article again, that article becomes the most recent entry and appears only once in the result. Do not use persistent storage, and do not consider thread safety. Function processArticleVotes(operations: String[][]) → String[][] Examples Example 1 operations = [["ADD","Alpha"],["ADD","Beta"],["ADD","Gamma"],["UPVOTE","1","u1"],["UPVOTE","2","u1"],["DOWNVOTE","1","u1"],["DOWNVOTE","2","u1"],["UPVOTE","1","u1"],["UPVOTE","3","u1"],["LAST_THREE","u1"]] return = [["1"],["2"],["3"],["Alpha","Beta"]] The first three rows are the assigned article IDs. Alpha and Beta both receive vote flips. Alpha is flipped again later, so it moves ahead of Beta. Gamma's first vote is not a flip.
Reported by candidates. Source: FastPrep
Pattern and pitfall
The trick is two structures per user. First, a map from (user, article) to the last vote, so you can tell a first vote, a repeat, and a flip apart. Second, an ordered collection of flipped article IDs per user where re-flipping moves the article to the front. A LinkedHashMap or a Map where you delete and reinsert gives you that in O(1). LAST_THREE just reads the three newest keys and maps IDs to titles. The common pitfall is counting a first vote as a flip, which Example 1 punishes with Gamma. Another is duplicating an article in the list instead of moving it. Also remember ADD returns the ID as a one-element row, and LAST_THREE can return fewer than three titles. If the recency ordering trips you up live, StealthCoder is the hedge that gets you unstuck fast.
If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.
You can drill Article Vote Tracker cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass Rippling's OA.
Rippling reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Article Vote Tracker FAQ
What's the trick in the Rippling Article Vote Tracker?+
Track each user's last vote per article. A flip only happens when a stored vote exists and the new one is opposite. Keep flipped articles in an insertion-ordered structure where a repeat flip deletes and reinserts the article, so it moves to the front and appears once.
How hard is this OA really?+
It's easy on algorithms and medium on care. No graph or DP, just hash maps and ordering. Most failures come from edge cases: first votes counted as flips, duplicate titles in the output, or forgetting that fewer than three results is valid.
Which data structures should I use?+
An array or list for article titles indexed by ID, a map keyed by user and article for current vote, and per user an ordered map or a deque with removal. Reading the last three is a short walk from the newest end.
Does a repeated vote change the order?+
No. Voting the same direction again is not a flip, so it doesn't touch the recency list. Only an actual change from upvote to downvote or the reverse updates the order and moves that article to the most recent spot.
How do I prepare for this in 48 hours?+
Practice LRU-style ordering with a hash map plus ordered keys, then write the operation dispatcher over a String[][] input. Trace Example 1 by hand. Make sure you output rows only for ADD and LAST_THREE, since votes produce no output.