Snowflake Coding Interview Questions
100 Snowflake coding interview problems with full optimal solutions — 30 easy, 50 medium, 20 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Snowflake interviewer values, and a FAQ section.
Showing 12 problems of 100
- #1easyfrequently asked
1. Two Sum
Given an array of integers and a target sum, return the indices of the two numbers that add up to target. Snowflake asks this as a warm-up to test if you can move from O(n^2) lookups to a hash-map index — the same mental jump a query planner makes when it picks a hash join over a nested-loop join.
- #2easyfrequently asked
2. Valid Parentheses
Determine whether a string of brackets is balanced. Snowflake uses this to test whether you can build a parser-like stack walk — the same primitive used to validate SQL parenthesization in their query parser.
- #3easyfrequently asked
3. Merge Two Sorted Lists
Merge two sorted linked lists into one sorted list. Snowflake asks this because it's the core primitive in a sort-merge join — and they want to see whether you handle the dummy-head pattern cleanly.
- #4easyfrequently asked
4. Remove Duplicates from Sorted Array
In-place deduplicate a sorted array, returning the new length. Snowflake asks this to test two-pointer mechanics and to set up a follow-up on dictionary-encoded columnar deduplication.
- #6easyfrequently asked
6. Search Insert Position
Given a sorted array and a target, return the index where the target is or where it would be inserted. Snowflake asks this to test binary-search mechanics — the same primitive used to locate a row by clustering key inside a micro-partition's min/max metadata.
- #8easyfrequently asked
8. Merge Sorted Array
Merge nums2 into nums1 in-place, both sorted, with nums1 sized to hold both. Snowflake asks this because it's the canonical 'merge in place from the back' trick — and the same trick used in external sort-merge runs.
- #12easyfrequently asked
12. Maximum Depth of Binary Tree
Find the depth of a binary tree. Snowflake uses this as a recursion warm-up and to set up a follow-up on B-tree fanout — the same calculation determines how many index levels a query traverses.
- #16easyfrequently asked
16. Best Time to Buy and Sell Stock
Find the max profit from one buy and one sell. Snowflake asks this to test single-pass min-tracking — the same one-pass min/max aggregation used to build column-chunk statistics during data ingestion.
- #18easyfrequently asked
18. Single Number
Find the one number in an array where every other appears twice. Snowflake asks this because the XOR trick is exactly the same primitive used to construct erasure-coded data: cheap, commutative, parallel-friendly.
- #20easyfrequently asked
20. Min Stack
Design a stack that supports push, pop, top, and getMin in O(1) time. Snowflake asks this to test whether you can co-locate state with operations — the same design principle behind their per-column aggregate accumulators.
- #29easyfrequently asked
29. Reverse Linked List
Reverse a singly linked list. Snowflake asks this as a pointer-manipulation warm-up and to verify that you can handle the three-pointer dance — the same kind of bookkeeping required when reversing scan direction inside their executor.
- #30easyfrequently asked
30. Contains Duplicate
Decide whether an array contains any duplicate value. Snowflake uses this to test the dedup primitive — and to lead into discussions of approximate-cardinality structures like HyperLogLog, which they use for APPROX_COUNT_DISTINCT.