cswork / libraryOpen practice workspace

Interview experiences · Reddit

Reddit Machine Learning Engineer Interview Experience — Onsite with a Cat/Dog Comment-Tree Filter and a Comment-Likelihood ML Design

OnsiteInterviewed 2026-09

Coding: seems like a new question? I had AI rewrite it: You are given a dictionary of Reddit comments. Each comment contains: id parent_comment body cat: whether the comment is about cats dog: whether the comment is about dogs Example input: Comments form a tree using parent_comment. There are two user modes: CAT_PERSON: does not want to see dog-related comments DOG_PERSON: does not want to see c…

Coding: seems like a new question? I had AI rewrite it:

You are given a dictionary of Reddit comments.

Each comment contains:

  • id
  • parent_comment
  • body
  • cat: whether the comment is about cats
  • dog: whether the comment is about dogs

Example input:

comments = {
    0: {"id": 0, "parent_comment": None, "body": "Look! A cute baby elephant taking a nap!", "cat": False, "dog": False},
    2: {"id": 2, "parent_comment": 1, "body": "I agree!", "cat": False, "dog": False},
    11: {"id": 11, "parent_comment": 0, "body": "Almost as cute as my poodle!", "cat": False, "dog": True},
}

Comments form a tree using parent_comment.

There are two user modes:

  • CAT_PERSON: does not want to see dog-related comments
  • DOG_PERSON: does not want to see cat-related comments

Rule: If a comment is about an undesired animal, exclude that comment AND all of its child/descendant comments.

Write a function:

def get_comments_to_exclude(comments, mode): ...

Return a set of comment IDs that should be excluded.

Example: if comment 5 is about dogs and the tree is:

5
└── 6
    └── 7
        └── 8

then for CAT_PERSON, return:

{5, 6, 7, 8}

Follow-up: What are the time and space complexities?

ML SD: comment likelihood, a question that's already been posted on the forum. They focused very heavily on feature serving and model serving.

Comments

Nothing here yet.

Join in on CSWork →