Snap Coding Interview Questions
26 Snap coding interview problems with full optimal solutions — 16 easy, 8 medium, 2 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Snap interviewer values, and a FAQ section.
- #28easyfoundational
28. Find the Index of the First Occurrence in a String
Snap's chat search highlights the first match of a keyword in a message thread — this is the substring-search primitive behind that feature.
- #48mediumfoundational
48. Rotate Image
Snap's camera pipeline rotates raw sensor frames in-place before applying AR filters — knowing how to transpose and reflect a matrix without allocating extra memory maps directly to that constraint.
- #56mediumfoundational
56. Merge Intervals
Snap Stories expire at varying times and the timeline renderer collapses overlapping active-story windows into continuous display segments — merge intervals is exactly that computation.
- #102easyfoundational
102. Binary Tree Level Order Traversal
Snap's story hierarchy — user stories nested inside friend-group stories nested inside curated collections — is a tree. Level-order traversal is how that hierarchy renders top-down in the UI.
- #133mediumfoundational
133. Clone Graph
Snap's friend-graph data model is serialized and deep-cloned for A/B test sandboxes and recommendation experiments — clone graph is the interview distillation of that operation.
- #146mediumfoundational
146. LRU Cache
Snap Memories and story previews rely on an LRU layer to decide which media blobs to keep in RAM — this problem is the exact data-structure contract that cache layer implements.
- #200mediumfoundational
200. Number of Islands
Snap's AR segmentation detects connected regions of similar pixels to isolate faces and objects — number of islands is the graph-traversal core of that pipeline.
- #215mediumfoundational
215. Kth Largest Element in an Array
Snap's notification ranking surfaces the top-K most-engaged snaps in a user's inbox — finding the Kth largest is the primitive that backs that ranking without a full sort.
- #286mediumfoundational
286. Walls and Gates
Snap Maps uses a similar multi-source BFS to compute the minimum walking distance from every map cell to the nearest point of interest — walls and gates is the canonical warmup for that spatial query.
- #297hardfoundational
297. Serialize and Deserialize Binary Tree
Snap persists user story-collection hierarchies to disk between app launches — serialize/deserialize is the interview form of the codec their persistence layer implements.
- #362mediumfoundational
362. Design Hit Counter
Snap's view-count and snap-open-rate metrics run through a sliding-window counter — this problem is the foundational design exercise behind that system.
- #621hardfoundational
621. Task Scheduler
Snap's filter-rendering pipeline processes tasks with mandatory cooldowns between same-type GPU operations — task scheduler is the exact scheduling problem that capacity planning team models.
- #1easyfrequently asked
1. Two Sum
Given an array of integers and a target, return the indices of the two numbers that add up to the target. Snap uses this warm-up to gauge if you instinctively reach for a hash-map cache versus brute-forcing the lookup.
- #2easyfrequently asked
2. Valid Parentheses
Given a string containing brackets, determine if every opening bracket is closed by the matching type in the correct order. Snap uses this to verify you reach for a stack on linear matching problems.
- #3easyfrequently asked
3. Merge Two Sorted Lists
Merge two sorted linked lists into one sorted list by splicing nodes together. Snap uses this to confirm you can manipulate pointers without copying values and without losing the head.
- #4easysometimes asked
4. Remove Duplicates from Sorted Array
Modify a sorted array in-place so each unique element appears once, returning the new length. Snap uses this to test in-place mutation discipline and two-pointer instincts.
- #5easyfrequently asked
5. Best Time to Buy and Sell Stock
Find the maximum profit from a single buy/sell on a price-per-day array. Snap uses this to verify you can convert a naive nested loop into a single-pass min-tracking sweep.
- #6easysometimes asked
6. Contains Duplicate
Return true if any value appears at least twice in the array. Snap uses this to confirm the candidate reaches for a hash set rather than nested loops.
- #7easyfrequently asked
7. Valid Anagram
Given two strings, decide whether one is an anagram of the other. Snap uses this to verify candidates avoid sort-based answers when a count-array is faster.
- #8easyfrequently asked
8. Reverse Linked List
Reverse a singly-linked list in place. Snap uses this to verify pointer-juggling fluency and ability to articulate both iterative and recursive solutions.
- #9easyfrequently asked
9. Linked List Cycle
Determine whether a linked list has a cycle. Snap uses this to test pointer fluency and to see if you reach for Floyd's tortoise-and-hare instead of a hash set.
- #10easyfrequently asked
10. Maximum Subarray
Find the contiguous subarray with the largest sum. Snap uses this to verify you know Kadane's algorithm and can recognize a 1D running-sum DP without prompting.
- #11easysometimes asked
11. Climbing Stairs
Count distinct ways to climb n stairs taking 1 or 2 steps at a time. Snap uses this as a 'do you spot Fibonacci' check before harder DP.
- #12easysometimes asked
12. Single Number
Find the one integer that appears once when every other appears twice. Snap uses this to test bit-manipulation insight under an O(1)-space constraint.
- #13easysometimes asked
13. Majority Element
Find the element that appears more than n/2 times. Snap uses this to verify candidates know Boyer-Moore voting, which is the canonical O(1)-space trick.
- #14easysometimes asked
14. Move Zeroes
Move all zeros in an array to the end while preserving relative order of non-zero elements. Snap uses this to test two-pointer in-place rearrangement.