The coding problem asked me to filter Reddit comments based on user preferences, where hiding one undesirable comment also hides its entire descendant subtree. The ML system design round focused on predicting comment likelihood, with significant attention paid to feature serving and model serving.
Interview Details
Coding — Filter Comment Subtrees by User Preference
You are given a dictionary of Reddit comments. Each comment contains:
id
parent_comment
body
cat — whether the comment is related to cats
dog — whether the comment is related to dogs
Comments form a tree through the parent_comment field.
For example:
comments = {
10: {
"id": 10,
"parent_comment": None,
"body": "That baby penguin is adorable.",
"cat": False,
"dog": False
},
14: {
"id": 14,
"parent_comment": 10,
"body": "My golden retriever does the same thing.",
"cat": False,
"dog": True
comments = {
10: {
"id": 10,
"parent_comment": None,
"body": "That baby penguin is adorable.",
"cat": False,
"dog": False
},
14: {
"id": 14,
"parent_comment": 10,
"body": "My golden retriever does the same thing.",
"cat": False,
"dog": True
Unlock Full Details
Create a free account to unlock this interview experience report.