Yelp Coding Interview Questions
25 Yelp coding interview problems with full optimal solutions — 15 easy, 7 medium, 3 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Yelp interviewer values, and a FAQ section.
- #1easyfoundational
1. Two Sum
Find two array indices whose values sum to a target — Yelp's warmup before scaling the same hash lookup to matching business IDs against a review-score target.
- #2easyfoundational
2. Valid Parentheses
Verify a string of brackets is well-formed using a stack — Yelp uses this to test the same nesting validation it runs on user-submitted query strings for advanced search filters.
- #3easyfoundational
3. Merge Two Sorted Lists
Merge two sorted linked lists into one sorted list — Yelp uses this as the conceptual cousin to merging two relevance-sorted review feeds before final ranking.
- #4easyfoundational
4. Remove Duplicates from Sorted Array
Compact a sorted array in-place — Yelp's stand-in for collapsing duplicate review entries from the same user before downstream ranking.
- #5easyfoundational
5. Remove Element
Filter out target values from an array in-place — Yelp uses this to test the same buffer-compaction logic that strips flagged reviews from a result page.
- #6easyfoundational
6. Search Insert Position
Binary-search a sorted array for an insert index — Yelp's gateway to the same lower-bound logic that places a new review at its correct rank-sorted slot.
- #7easyfoundational
7. Plus One
Increment a big integer stored as a digit array — Yelp uses it to gauge how cleanly you handle carry-propagation, the same edge case in totaling review counts past 9.
- #8easyfoundational
8. Merge Sorted Array
Merge nums2 into nums1 in-place — Yelp's analog for combining two sorted batches of incoming reviews into a single chronological feed without extra memory.
- #9easyfoundational
9. Binary Tree Inorder Traversal
Return the inorder traversal of a binary tree — Yelp treats this as the warmup for sorted enumeration over the BST that backs nearby-business range queries.
- #10easyfoundational
10. Same Tree
Check whether two binary trees are structurally identical — Yelp uses this as the canonical recursion warmup before diving into category-tree comparison tasks.
- #11easyfoundational
11. Maximum Depth of Binary Tree
Compute the maximum depth of a binary tree — Yelp uses this to gauge whether candidates can recurse cleanly over a category-tree before walking deeper geo-indexing problems.
- #12easyfoundational
12. Best Time to Buy and Sell Stock
Find the maximum profit from a single buy and sell of a stock — Yelp uses this single-pass min-tracking pattern to test how candidates handle review-ranking score deltas over time.
- #13easyfoundational
13. Valid Palindrome
Determine whether a string is a palindrome after stripping non-alphanumerics and lower-casing — Yelp uses this to test two-pointer fluency before scaling to review-fraud near-duplicate detection.
- #14easyfoundational
14. Single Number
Find the unique element in an array where every other element appears twice — Yelp uses this XOR trick to test whether candidates can spot an O(1)-space win before scaling to dedup in review pipelines.
- #15easyfoundational
15. Majority Element
Find the element that appears more than n/2 times in an array — Yelp uses Boyer-Moore voting to test whether candidates can find an O(1)-space majority before scaling to dominant-keyword detection across reviews.
- #16mediumfoundational
16. Longest Substring Without Repeating Characters
Find the length of the longest substring with all distinct characters — Yelp uses this sliding-window pattern to test whether candidates can scale to deduping review n-grams.
- #17mediumfoundational
17. Longest Palindromic Substring
Find the longest palindromic substring in a string — Yelp uses expand-from-center to test a candidate's ability to find structural patterns inside long review text bodies.
- #18mediumfoundational
18. 3Sum
Find all unique triplets in an array that sum to zero — Yelp uses sort + two-pointer to test whether candidates can dedupe and scale before tackling geo-clustered triplet matching.
- #19mediumfoundational
19. Group Anagrams
Group an array of strings by anagram class — Yelp uses this canonicalization pattern to test whether candidates can bucket reviews by stable signature for fraud clustering.
- #20mediumfoundational
20. Merge Intervals
Merge a list of overlapping intervals — Yelp uses sort + sweep to test whether candidates can collapse adjacent business-hours ranges before scaling to geo-cell overlap merging.
- #21mediumfoundational
21. Number of Islands
Count connected components of '1's in a 2D grid — Yelp uses flood-fill to test whether candidates can scale grid traversal to geo-cell clustering of dense business regions.
- #22mediumfoundational
22. Kth Largest Element in an Array
Find the kth largest element in an unsorted array — Yelp uses min-heap-of-size-k to test whether candidates can scale top-k selection to a top-rated-businesses leaderboard.
- #23hardfoundational
23. Median of Two Sorted Arrays
Find the median of two sorted arrays in O(log(min(m,n))) — Yelp uses this binary-search-on-partition trick to test whether candidates can find log-time medians in merged review-score streams.
- #24hardfoundational
24. Merge k Sorted Lists
Merge k sorted linked lists into one — Yelp uses min-heap-of-heads to test whether candidates can scale a streaming merge to fanned-in review-event shards.
- #25hardfoundational
25. Trapping Rain Water
Compute how much water can be trapped between elevation bars — Yelp uses the two-pointer max-tracking solution to test whether candidates can compress prefix/suffix max into one pass for recommendation-score smoothing.