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.
Showing 16 problems of 26
- #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.
- #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.
- #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.