Pinterest Software Engineer Coding & Algorithms Interview Questions
Master your tech interview with our curated database of real questions from top companies.
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 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 integer multiplication
Given two non-negative integers represented as decimal strings, return their product as a decimal string without using built-in big-integer or arbitra...
Reconstruct itinerary with lexicographic ties
You are given m airline tickets as directed pairs [from, to]. Build an itinerary that starts at a specified airport start (e.g., "JFK") and uses every...
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...
Cross-reference logs to flag spam numbers
You are given two data sets: ( 1) a call log containing phone numbers observed in calls and ( 2) a list of user reports where each entry is a phone nu...
Settle debts with minimal transactions
You are given a list of debts as triples (debtor, creditor, amount), where each amount > 0. Return a set of settlement transfers (from, to, amount) th...
Design ID allocator with resizable bucket ranges
Given a fixed global ID space [0, 999] and an initial list of bucket specifications, where each bucket has a unique name and an inclusive ID range [st...
Compute minimal transactions to settle debts
You are given a list of transactions (payer, payee, amount) among a set of people. Compute a sequence of transfers that settles all net balances using...
Determine equality of arbitrarily nested sets
Implement a function that determines whether two arbitrarily nested sets are equal. Sets are unordered and contain no duplicates; elements can be inte...
Implement string-based big integer multiplication
Implement multiplyStrings(a, b) to multiply two non-negative integers given as decimal strings and return the product as a string without converting t...
Design adjustable ID allocator
You manage an integer ID space [0, 999] and N named buckets in a fixed order. Implement two operations: ( 1) allocate(buckets: List<(name, desired_siz...
Decide target via subsequence plus/multiply expression
Given a sequence of positive 32-bit integers A and an integer target, determine whether there exists a subsequence of A (preserving order, using each ...
Determine subsequence expression equals target
Question Given a sequence of positive 32-bit integers A and an integer target, determine whether there exists a subsequence of A (each element used at...
Find minimal time to serve customers
You manage a bank with k tellers; teller i takes serviceTimes[i] minutes to serve one customer and works continuously. Given an integer array serviceT...
Find minimum shuttle transfers
You are given a collection of shuttle loops, each represented by a list of stop IDs that the loop visits in perpetuity. You may board a shuttle at any...