Pinterest Coding & Algorithms Interview Questions
Practice the exact questions companies are asking right now.
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 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...
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 ...
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...
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...
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 ...
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...
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(...
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 string-based rounding without floats
Coding You are not allowed to parse the input into a built-in floating type (to avoid overflow and precision issues). Work directly on strings. 1) Imp...
Solve a 9x9 Sudoku puzzle
Given a partially filled 9×9 Sudoku board, fill the empty cells so that the completed board is valid. A valid Sudoku satisfies: - Each row contains di...
Solve set equality and ad log top‑K
Problem Set (Coding) 1) Check whether two sets are equal You are given two integer arrays A and B that represent sets, except they may contain duplica...
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',...