rippling tech phone screen: article votes service for software engineer
Interview Experience
新鲜面经
我觉得不如不选 AI coding,自己写说不定更好一点。求个大米看面经,谢谢大家了🙏🙏
以下内容需要积分高于 110 您已经可以浏览
题目背景
题目是 article votes,但是我只看了另外四道高频,这题感觉不算高频就没仔细看,而且这个 article votes 还有个实现 API 的题目和这个是不一样的。
Part 1
We are building the vote management service for an online news platform, where users can upvote or downvote published articles.
We are interested in what makes users change their minds.
Let's start with the following functionality:
add_article(article_name [string])
复制代码
Each article is given an incremental inte...
Full Details
新鲜面经
我觉得不如不选 AI coding,自己写说不定更好一点。求个大米看面经,谢谢大家了🙏🙏
以下内容需要积分高于 110 您已经可以浏览
题目背景
题目是 article votes,但是我只看了另外四道高频,这题感觉不算高频就没仔细看,而且这个 article votes 还有个实现 API 的题目和这个是不一样的。
Part 1
We are building the vote management service for an online news platform, where users can upvote or downvote published articles.
We are interested in what makes users change their minds.
Let's start with the following functionality:
add_article(article_name [string])
复制代码
Each article is given an incremental integer ID when it's added, starting with 1.
upvote_article(article_id [integer], user_id [integer])
复制代码
Assume any user ID is valid, and that the given article ID will have been added.
downvote_article(article_id [integer], user_id [integer])
复制代码
Assume any user ID is valid, and that the given article ID will have been added.
print_last_three_flips(user_id [integer])
复制代码
The titles of the last three unique articles for which the given user changed their vote, either from upvote to downvote or downvote to upvote.
For our MVP, consider performance as we will eventually support millions of articles and users.
However, let's not worry about thread safety or persistence for now - store data in memory.
Let's prioritize solving the problem for the last three articles for now.
We can tackle extensibility at a later stage.
第二问
def get_top_k(k):
👍 加一分,👎 减一分,找出 top k 的文章。
第一问的答案(仅供参考)
class Article:
def init(self, article_id: int, name: str):
self.id = article_id
self.name = name
class VoteService:
def init(self):
self.articles: dict[int, Article] = {}
self.article_counter = 0
self.user_votes_map: dict[int, dict[int, int]] = defaultdict(dict)
self.user_flips_deque: dict[int, deque] = defaultdict(deque)
def add_article(self, article_name: str) -> Article:
self.article_counter += 1
article = Article(self.article_counter, article_name)
self.articles[self.article_counter] = article
return article
def upvote_article(self, article_id: int, user_id: int) -> None:
self._vote(article_id, user_id, 1)
def downvote_article(self, article_id: int, user_id: int) -> None:
self._vote(article_id, user_id, -1)
def _vote(self, article_id: int, user_id: int, value: int) -> None:
user_votes = self.user_votes_map[user_id]
last_vote = user_votes.get(article_id)
user_votes[article_id] = value
if last_vote is not None and last_vote != value:
dq = self.user_flips_deque[user_id]
try:
dq.remove(article_id)
except ValueError:
pass
dq.append(article_id)
if len(dq) > 3:
dq.popleft()
def print_last_three_flips(self, user_id: int) -> None:
dq = self.user_flips_deque[user_id]
names = [self.articles[aid].name for aid in reversed(dq)]
print(names)
About This Question
This is a candidate experience report from a rippling interview for a swe role (newgrad level) during the phone screen round reported in 2026.