← Roblox Interview Insights

Roblox·Data Scientist·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Roblox data scientist round with a pandas question around cleaning up friendship data from raw request logs. Pretty focused, one problem, not a lot of fluff.

Questions Asked (1)

Q1

Given a table of friend request logs, write Python/pandas code that returns each unique friendship pair exactly once (with the smaller user ID listed first) along with the date the friendship was accepted.

Product Analytics & MetricsAlgorithms & Data Structures
Author's notes

The core idea is simple enough: filter to accepted requests, normalize the id ordering so (1,2) and (2,1) don't show up as separate rows, then deduplicate.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, filter the friend request logs to only accepted requests. Then, normalize each pair by sorting the two user IDs so the smaller ID comes first, and drop duplicates to ensure each friendship appears once. Finally, select the normalized user columns and the acceptance date.

Pro tip: Clarify the definition of 'accepted date'—it might be a separate column or the date when status changed to accepted. Also, consider edge cases like self-friend requests or duplicate accepted requests.

1. Filter accepted requests

Select rows where the request status is 'accepted' (or equivalent). This ensures we only consider actual friendships.

2. Normalize user pair order

Create two new columns: user_min and user_max, where user_min is the smaller of the two user IDs and user_max is the larger. This ensures each pair is represented consistently.

3. Remove duplicate pairs

Drop duplicates based on the normalized user pair columns, keeping the first occurrence (or the earliest acceptance date if multiple exist).

4. Select and rename columns

Select the normalized user columns and the acceptance date column, and rename them appropriately (e.g., user1, user2, accepted_date).

Key Points to Mention

  • Filtering by status to only include accepted requests
  • Using min/max or sorting to ensure smaller user ID first
  • Dropping duplicates to get unique friendship pairs
  • Handling potential multiple acceptance dates (e.g., keep earliest)
  • Considering self-friend requests (exclude if user1 == user2)
  • Efficiency: using vectorized operations in pandas

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.