Skip to main content

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 16 problems of 100

  • #81hardsometimes asked

    81. Median of Two Sorted Arrays

    Find the median of two sorted arrays in O(log(min(m, n))). Snowflake asks this to test binary search on partitions — directly relevant to merging sorted micro-partitions for median computation during APPROX_PERCENTILE follow-up.

  • #82hardsometimes asked

    82. Regular Expression Matching

    Implement regex matching with . and *. Snowflake asks this for 2D DP with branching transitions — directly relevant to their REGEXP_LIKE evaluator and LIKE pattern matching.

  • #84hardsometimes asked

    84. Reverse Nodes in k-Group

    Reverse a linked list in groups of k nodes. Snowflake asks this because batched reversal in groups is precisely how their executor flips row direction in fixed-size batches for ORDER BY DESC over partial micro-partitions.

  • #85hardrarely asked

    85. Substring with Concatenation of All Words

    Find all starting indices where a substring is a concatenation of every word exactly once. Snowflake asks this for multi-key sliding-window mastery — relevant to multi-column join-key matching in streaming joins.

  • #86hardrarely asked

    86. Longest Valid Parentheses

    Find the longest valid parentheses substring. Snowflake asks this for stack-with-index — relevant to recovering nesting depth during SQL parser error reporting.

  • #87hardrarely asked

    87. Sudoku Solver

    Solve a 9x9 Sudoku puzzle. Snowflake asks this to test backtracking with constraint propagation — relevant to constraint solving during type inference and constraint validation.

  • #88hardsometimes asked

    88. First Missing Positive

    Find the smallest missing positive integer in O(n) time and O(1) space. Snowflake asks this for the cyclic-placement trick — relevant to building dense column-id mappings during data ingestion.

  • #89hardsometimes asked

    89. Trapping Rain Water

    Compute the volume of water trapped between bars after rain. Snowflake asks this for the two-pointer trick — relevant to computing memory-bound estimation in their planner where left and right side constraints both matter.

  • #92hardrarely asked

    92. N-Queens

    Place n queens on an n x n chessboard so none attack each other. Snowflake asks this as the canonical backtracking-with-constraint-bitmask — relevant to constraint solving during query rewrite where multiple non-conflicting predicates must be selected.

  • #93hardrarely asked

    93. N-Queens II

    Count the number of distinct n-queens solutions. Snowflake asks this for pure constraint counting — directly relevant to counting valid plan configurations during planner exploration.

  • #94hardsometimes asked

    94. Insert Interval

    Insert a new interval into a sorted list of non-overlapping intervals, merging where needed. Snowflake asks this for streaming-friendly interval management — relevant to incremental micro-partition coalescing during continuous ingestion.

  • #95hardrarely asked

    95. Valid Number

    Determine whether a string is a valid number (integer, decimal, or scientific notation). Snowflake asks this because their SQL parser must tokenize numeric literals correctly — and the spec is full of edge cases.

  • #96hardrarely asked

    96. Text Justification

    Justify text to a fixed width, distributing spaces evenly. Snowflake asks this to test careful greedy packing with edge-case spacing — relevant to formatted CSV unload and result-set pretty-printing.

  • #97hardsometimes asked

    97. Largest Rectangle in Histogram

    Find the largest rectangle area in a histogram. Snowflake asks this for the monotonic-stack pattern — directly relevant to range-max queries during query optimization.

  • #98hardrarely asked

    98. Maximal Rectangle

    Find the largest rectangle of 1s in a binary matrix. Snowflake asks this as the 2D extension of Largest-Rectangle-in-Histogram — relevant to range-max queries over rectangular data tiles.

  • #99hardrarely asked

    99. Scramble String

    Determine whether one string can be obtained by recursively partitioning another. Snowflake asks this for recursive partitioning with memoization — same recursion shape as proving plan equivalence under reordering.

Snowflake Coding Interview Questions — Full Solutions — InterviewChamp.AI