cswork / libraryOpen practice workspace

Interview experiences · Pinterest

Pinterest Data Scientist Interview Experience — Two SQL Questions and Similar Pins in Python

Tech screenInterviewed 2026-09

I'm sharing the questions I encountered in a Pinterest technical interview. I've organized them to give back, and I hope this helps anyone preparing! The descriptions below are reconstructed from memory. I've simplified the field names; these aren't word-for-word copies of the original questions. SQL: The top two categories by engagement rate in each country (I don't quite remember exactly how ma…

I'm sharing the questions I encountered in a Pinterest technical interview. I've organized them to give back, and I hope this helps anyone preparing!

The descriptions below are reconstructed from memory. I've simplified the field names; these aren't word-for-word copies of the original questions.

  1. SQL: The top two categories by engagement rate in each country (I don't quite remember exactly how many).

Two tables:

  • events: event_id, user_id, pin_id, event_type, event_ts, country_code.
  • pin_info: pin_id, category.

event_type includes impression and click.

Requirements:

  • Count clicks and impressions for each category in each country over the past 30 days.
  • Engagement rate = clicks / impressions.
  • Keep only categories with at least 2 impressions.
  • Rank by engagement rate within each country, return categories ranked 1 and 2, and retain ties.
  • Output country_code, category, impressions, clicks, engagement_rate, and rank, sorted by country, rank, and category.

My approach: Join the two tables first, aggregate by country + category, then use a window ranking within each country.

  1. SQL: The proportion of highly active users in each country.

One impressions table:
impression_id, user_id, pin_id, surface, impression_ts, country_code.
Surfaces include home, search, and related_pins.

For the most recent 7 days, including today:

  • Active user: at least one impression in the window.
  • Highly active user: active on at least 4 distinct dates in the window, and used at least 3 distinct surfaces on at least one day.
  • Evaluate the same user separately in different countries.

Output for each country:

  • active_users
  • highly_active_users
  • highly_active_pct, on a 0–100 scale with 2 decimal places.

Sort by highly_active_pct descending, then country_code ascending.

My approach: First count distinct surfaces per country + user + day. Then aggregate by country + user to count active days and determine whether any day meets the surface-count requirement. Finally, calculate the proportion by country.

Watch out: The requirement of at least 3 surfaces has to be met on the same day. You can't combine surfaces across the whole 7-day period. Also, the numerator and denominator must use the same date window.

  1. Python: Similar Pins / co-occurrence counts.

The input is a dictionary of lists, with several pins in each list. The core task is to count how often different pins occur together in these lists, using co-occurrence to measure similarity between pins.

Here's an example I made up just to illustrate:

{
  "list_1": ["A", "B", "C"],
  "list_2": ["A", "B"],
  "list_3": ["B", "C"]
}

A and B co-occur twice, A and C once, and B and C twice.

For preparation, you can practice traversing lists, generating pin pairs, and accumulating counts with a dictionary / Counter. Confirm whether you need to deduplicate individual lists and how to organize the final result based on the exact question.

Hope this helps everyone. Good luck with your interviews, and I hope I land a job soon too!

Comments

Nothing here yet.

Join in on CSWork →