Pinterest Coding & Algorithms Interview Questions
Master your tech interview with our curated database of real questions from top companies.
Calculate 95% Bootstrap Confidence Interval for Order Values
Scenario An e-commerce firm wants a 95% confidence interval for the average order value but only has a single historical sample of order amounts. Ques...
Implement DelayQueue with Idempotent Task Execution
Scenario Message broker offers DelayQueue where tasks execute at future timestamps, ensuring idempotency on duplicate IDs. Question Implement a delay ...
Implement Data Structure for Top-K Elements in Streams
Scenario Analytics feature that must constantly report the K largest numbers seen so far. Question Implement a data structure that ingests a stream of...
Design Algorithm to Minimize Payments in Expense-Sharing App
Scenario Expense-sharing app needs to settle debts among friends after a trip. Question Given a list of transactions (payer, payee, amount), design an...
How to Design a Proportional Randomized Sampler?
Scenario Randomized promotion engine must pick an item proportional to its score, but scores have no upper bound. Question Design a sampler pick() tha...
Determine Pin Connections Through Common Boards
Scenario Pinterest boards contain many pins; need to infer relationships between pins. Question Given the membership lists of all boards, write a func...
Maximize Non-Overlapping Task Scheduling Efficiency
Scenario Job scheduler on a single machine wants to maximise throughput. Question Given tasks with [start, end) times, return the maximum number of no...
Round numeric string values
Question Given a numeric string, implement rounding to the nearest integer (e.g., '3.5' → '4', '100.01' → '100'). Follow-up: round to the last signifi...
Implement LRUCache with O(1) Operations and Thread Safety
Scenario High-traffic API needs constant-time eviction cache. Question Implement an LRUCache supporting get(key) and put(key,val) in O( 1). Describe ...
Decode and Explain Ambiguity in Compression Strings
Scenario Compression library that encodes an array as count-value pairs where value is one digit but count may be many digits. Question Implement deco...
Design Data Structure for Sparse Matrices Operations
Scenario Analytics engine stores extremely sparse numeric matrices. Question Design a data structure to store two sparse matrices and implement print(...
Implement Function to Return First n Prime Numbers
Scenario Quick algorithm screen to gauge Python fluency. Question Implement a Python function that returns the first n prime numbers. Hints An optimiz...
Design Efficient Multi-Level Access Control System
Scenario Multi-level access control lists (country → city) must be queried quickly. Question Design and implement a permission system where each geogr...
Develop Auto-Complete System for Dish Suggestions
Scenario Search-as-you-type needs dish suggestions with popularity scores. Question Build an auto-complete system using the given (string, score) tupl...
Implement a min-heap column allocator
You are given an integer k (number of columns) and an array posts of positive integers where posts[i] is the height of the i-th post. All columns star...
Implement and extend My Calendar III
Design and implement a booking system like LeetCode 732 (My Calendar III). Provide a class with methods: book(start, end) using half-open intervals [s...
Find list pair with maximum overlap
You are given N labeled lists of items as a Python dict mapping list_name -> iterable of strings. Example input: {'L1': ['A','B','C'], 'L2': ['A','C',...
Implement scalable prime generator
Write a function first_n_primes(n) that returns the first n prime numbers in ascending order. Constraints: - 1 ≤ n ≤ 100,000. - Aim for O(n log log n)...
Compute average unique pins per user
Task: Average Unique Pins Per User You are given a mapping from user IDs to their lists of pin IDs. Implement a function that computes the mean number...
Design a violation log analyzer
You are given an append-only list of violation events as tuples (id: string, policy: string, date: ISO-8601 string). Build an in-memory "Violation Log...