Snowflake Software Engineer Coding & Algorithms Interview Questions
Practice the exact questions companies are asking right now.
Validate an extended tic-tac-toe state
Problem You are given a 3×3 tic-tac-toe board state as an array of 3 strings, each of length 3. Each cell is one of: - 'X' (player X) - 'O' (player O)...
Implement course scheduling and rate limiter analysis
You are given two independent coding problems. --- Problem 1: Course Scheduling You are planning to take a set of courses and are given prerequisite r...
Design transactional in-memory key-value store
Problem Design and implement an in-memory key–value store that supports basic operations plus transactions. Core API Implement the following operation...
Set second tree values by subtree sums
Given the roots of two complete binary trees T1 and T2 that have identical structure and the same number of nodes, replace each value in T2 with the s...
Compute shortest path between tree nodes
You are given the root of a binary tree with unique integer values and two target values u and v. Return the sequence of node values along the shortes...
Check balanced parentheses with multiple bracket types
Given a string containing only parentheses '()', determine whether it is balanced. Follow-up: extend the solution to also support '[]' and '{}' with c...
Serialize and deserialize a dictionary trie
Design and implement serialization and deserialization for a trie that stores a large dictionary of words. Requirements: compact wire format; explicit...
Design error detection and propagation algorithms
You are given three related sub-problems about error detection and propagation. A) Log search: You have a chronologically ordered array of log lines. ...
Find longest unique-character substring
Given a string s, return the length of the longest substring without repeating characters. Explain and implement an O(n) sliding-window solution using...
Compute shortest path between two tree nodes
Given a binary tree (not necessarily a BST) and two node values u and v, implement a function that returns the shortest path between them as a list of...
Serialize and deserialize a dictionary trie
Design data structures and algorithms to serialize and deserialize a dictionary trie storing lowercase English words. Specify a compact wire format th...
Transform tree using counterpart subtree sums
Given the roots of two complete binary trees with identical structure, modify the node values of the second tree so that each node equals the sum of a...
Implement crawler and bracket validator
Implement two tasks: ( 1) Write a function crawl(start_urls, fetch, max_depth, domain_filter) that visits pages starting from the given seed URLs usin...
Filter hierarchical paths after deletions
Given two arrays: ( 1) paths — slash-delimited hierarchical strings such as "California", "California/San Francisco", "California/San Francisco/7th St...
Schedule dependent services with layered startup
You are given N services and dependency pairs (u -> v) meaning u must start before v. 1) Produce a valid startup order if one exists; otherwise detect...
Solve build ordering and expression evaluation
Part A — Dependency ordering: You are given an integer n (0 ≤ n ≤ 200000) representing tasks labeled 0..n-1 and a list of prerequisite pairs [a, b] me...
Compute task order and layered execution
You have N tasks labeled 0..N-1 and prerequisite pairs (a, b) meaning task a must complete before task b can start. Return any valid execution order o...
Find longest substring with at most k distinct
Given a string s and an integer k, return the length of the longest contiguous substring that contains at most k distinct characters. Provide an O(n) ...
Find first error and propagate failures
You are given a chronological log history where each entry is a string prefixed with one of [Info], [Warn], or [Error]. Two invariants hold: ( 1) once...
Compute height after deletions; enumerate valid delete sets
Warm-up: You are given a rooted binary tree with unique node ids and a list of ids to delete. When a node is deleted, promote all of its children to b...