Design article voting and flip-tracking system
Company: Rippling
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
This question evaluates object-oriented design, stateful data modeling, vote aggregation, and time-ordered event history tracking competencies in the Software Engineering Fundamentals domain.
Company: Rippling
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Technical Screen
Design an object-oriented "Article System" that supports voting and query operations.
You need to design the data model and core APIs (including method signatures and internal logic, but not full code) for an in-memory service that manages articles and user votes.
The system should provide at least the following methods:
def add_article(article_name) -> article_id
article_id
for the newly created article.
def up_vote_article(article_id, user_id) -> None
user_id
on
article_id
.
def down_vote_article(article_id, user_id) -> None
user_id
on
article_id
.
up_vote_article
: a user's effective vote on an article is unique at any time.
def get_most_recent_3_flip_article(user_id) -> List[article_id]
user_id
, return the
3 most recent articles
on which this user has
changed their mind
(flipped from upvote to downvote or from downvote to upvote).
def get_top_k(k: int) -> List[article_id]
score = (#upvotes) - (#downvotes)
.
k
articles with the highest scores, ordered from highest score to lower.
get_most_recent_3_flip_article
accurately.
Describe:
Article
,
User
,
Vote
,
ArticleService
).
Do not provide full implementation code; instead, focus on a clear OOD and how the methods behave internally.
Quick Answer: This question evaluates object-oriented design, stateful data modeling, vote aggregation, and time-ordered event history tracking competencies in the Software Engineering Fundamentals domain.