HackTheRounds Interview Experiences

Pinterest Software Engineer Interview Experience (2026) - Top K Stream, Pin Dedupe & Home Feed Ranking, Offer

Pinterest 2026 SDE II loop: HackerRank OA with rolling top K boards, anagram pin dedupe, sessionization; onsite covering campaign windows, personalized feed des

By Anonymous · 2026-04-17

Background

Two years into a backend role at ByteDance where I mostly wrote Java and Go for distributed services, I decided to test the market in the US and Pinterest was on the shortlist because of the discovery-engine work the infra org posts about. A recruiter pinged me through a headhunter in early October and the loop started about a week later. I applied to the SDE II band at the Seattle office.

Timeline

Online Assessment (90 min, HackerRank)

Three problems. Language choice was Java, Go, Python, or C++. I wrote in Java because that's what my day job uses. The time budget is actually generous if you know the patterns; I finished with 12 minutes to spare and used it to re-check edge cases.

Problem 1: Top K Frequent Boards in a Stream (Medium, 25 min)

Problem: Given a stream of (board id, engagement score) events and a rolling 5-minute window, at any point in time return the K boards with the highest total engagement within the window. Required: O(1) amortized updates and O(log K) on the query.

Data structures: a HashMap<Long, Long from board id to running sum in the window, a Deque<Event holding (board id, score, timestamp) for expiry, and a min-heap of size K keyed by (sum, board id) . On every event I walk the deque popping entries older than 5 minutes and subtracting their scores, then push the new event and update the heap.

The snag is that stale heap entries (boards whose sum has since changed) cause incorrect reads. I handled it lazily: on query, peek the top, verify its score matches the current map value, and pop stale entries until consistent. Amortized O(log K). Follow-up was "what if K is huge and rebalance is expensive" — I proposed Reservoir Sampling for approximate top-K.

Problem 2: Dedupe Near-Identical Pin Titles (Hard, 35 min)

Problem: Given n pin titles, group titles that are case-insensitive and punctuation-stripped anagrams of each other. Return the groups.

My pipeline: for each title, lowercase it, strip non-alphanumerics, and derive a canonical anagram key by sorting the characters. A HashMap<String, List<String groups titles by that key, and the final answer is the set of map values.

O(n L log L) where L is max title length. The interviewer asked if a character-count array could replace the sort for O(n L). Yes, and I swapped the sort for a 36-slot int[] (26 letters plus 10 digits) used as the key. Same shape of code, one less log factor.

Problem 3: Sessionize User Actions (Medium, 20 min)

Problem: Given a list of user actions sorted by timestamp, split them into sessions where consecutive actions within the same session have a gap no larger than 30 minutes. Return the count of sessions per user.

Single pass, per-user last-timestamp tracker. If the current timestamp minus the last seen for that user exceeds 30 minutes (or it's their first event), increment session count and update the last seen. O(n) time, O(U) space where U is number of users. The edge case I caught late: events with identical timestamps for the same user count as a single session.

Virtual Onsite (4 rounds, all on Zoom plus CoderPad)

Two coding, one system design, one behavioral plus culture fit. Spread over three days in the same week.

Round 1: Coding — Merge Overlapping Campaign Windows

Problem: Given a list of ad campaign active windows (start, end) , merge overlapping windows and return the merged list. Follow-up: each window has a priority and the merged window's priority is the max of its components.

Classic sort-by-start plus linear scan: if the current window starts at or before the last merged window's end, extend the end; otherwise push a new window. For the priority variant I carried the running max priority forward alongside the merge. O(n log n) from the sort, O(n) scan.

Follow-up: "What if windows arrive as a stream and we need the merged set at any time?" I proposed a balanced BST of disjoint intervals keyed by start, with predecessor lookup on insert. Each insert merges with the predecessor and any overlapping successors. O(log n) amortized.

Round 2: System Design — Personalized Home Feed

Problem: Design Pinterest's related-pins home feed. Billions of pins, hundreds of millions of users, real-time ranking, sub-200ms p99 on feed load.

I spent five minutes on requirements first. The interviewer cared about scale (10^9 pins, 10^8 DAU), latency (p99 under 200ms), freshness, and personalization quality.

My architecture:

  • Offline layer. Daily Spark jobs compute pin embeddings (text plus image encoders), user embeddings, and an ANN candidate index (Faiss or ScaNN).
  • Online candidate generation. Fetch user embedding, query ANN for ~5000 candidates, mix in followed boards, trending, and co-engagement sources.
  • Ranking service. Stateless Go scorer using a GBDT or small two-tower DNN. Features come from a Feature Store (Redis hot, Cassandra cold).
  • Realtime signals. Kafka stream of user actions feeds a Flink job that updates short-term state (last 50 pins viewed, recent dwell) into Redis.

The interviewer drilled on embedding refresh cadence (daily fine for pins, hourly for cold users, near-realtime for active) and on scaling the ANN index to 10B pins (shard by pin id, query all shards, merge).

Round 3: Behavioral + Pinterest Values

Three prompts: "Tell me about a time you simplified a complex system," "How do you balance Pinner experience with business metrics," and "Tell me about a disagreement with a PM."

Simplification story: an internal feed-deduplication service that was O(n^2) across user cohorts because it compared every pin against every other pin using a cosine-similarity service. I rewrote it using SimHash for a fingerprint and a locality-sensitive hash index, dropping it to effectively O(n) average with p99 down from 1.2s to 80ms. The interviewer wrote down the specific numbers.

The Pinner-versus-metrics question is where Pinterest specifically tests values alignment. My answer was about a time we deprioritized a short-term CTR-boosting change because it created more clickbait. I framed the tradeoff in terms of long-term retention rather than "we did the right thing," which landed better.

Round 4: Coding — Search Suggestions With Trie

Problem: Implement an autocomplete that, given a prefix, returns the top 3 lexicographically smallest matching words. Words are added to the dictionary up front and may be added online.

I started with a Trie where each node holds a TreeSet<String of the three smallest words in its subtree. On insert, walk the trie and update every node's set. Lookup is O(P). The interviewer wanted less memory: TreeSet has per-entry overhead. I swapped to a sorted String[3] array with manual insertion-sort, cutting memory without changing asymptotic cost. Follow-up was top 10 by popularity instead of lexicographic order; I proposed per-word frequency plus a size-10 min-heap at each affected node.

Practice it: [[problem/475?company=28|Search Autocomplete with Trie]]

Result

Verbal offer mid-November, written offer 3 business days later. SDE II at the Seattle office, which was my preference. Comp was competitive: base near the top of the SDE II band, standard equity grant over 4 years with a 1-year cliff, and a reasonable sign-on. Negotiation got me about 8K more on base and a larger sign-on after I mentioned a competing offer.

Tips

  1. Pinterest's OA leans on streaming and windowing. Rolling-window top-K and sessionization are on brand; both mirror internal service patterns. Drill deque-backed sliding windows and session-gap splits before the OA.
  2. For the design round, know the ranking stack cold. Candidate generation, feature store, ranker model, realtime signals. Pinterest is a discovery company and feed ranking is their flagship; half-baked answers get probed hard.
  3. Bring specific numbers to the behavioral. "I made a service faster" is not enough. Pinterest rounds ask for before/after metrics. Memorize latency, QPS, and cost deltas from your project.
  4. The Trie autocomplete is a Pinterest staple. Variations came up in roughly half the loops I compared notes on. Memory-optimized tries (sorted arrays instead of TreeSets, prefix compression) are worth practicing.
  5. Values alignment is tested, not checkbox. The "Pinners first" prompt probes real product-vs-metric tradeoffs. Have an answer that shows tension, not a lecture on being user-first.
  6. Ask about team placement early. Pinterest infra orgs vary a lot. I asked in the recruiter call and again in the HM round, which helped me land on a backend-infra team rather than a feature team by accident.

Pinterest's loop felt more mission-driven than most big-tech interviews I did. The bar on pure algos is a notch below Google but system design and behavioral are where they actually separate candidates. Prepare accordingly.