HackTheRounds Interview Experiences

Snowflake Online Assessment Interview Experience (2024) - Data Processing & SQL

Snowflake new grad OA with two timed coding problems focused on data structures and a bonus SQL style aggregation. Shares problem patterns and strategy for the

By Anonymous ยท 2024-11-06

Background

Snowflake has been on my short list since I started paying attention to companies outside the obvious FAANG set. The cloud data warehouse space is interesting and the engineering problem of running SQL at scale over other people's storage is one of the cleaner systems bets of the last decade. I am a final-year CS student with two internships behind me, one in backend infrastructure at a mid-sized fintech and one on a data-platform team at a health-analytics company. I applied through the university portal in early fall and the OA landed in my inbox about ten days later. The post is an OA-only write-up because I am still waiting on a decision at the time of writing.

Timeline

Online Assessment

The Snowflake OA is 90 minutes, three coding problems, and no personality or logic sections. The platform is HackerRank-style with a built-in editor and a runner that shows sample test results but hides the grading cases. I found the platform itself smooth; nothing about the tooling fought me. What caught me off guard was how much the problems emphasize input robustness and complexity targets rather than novel algorithmic insight. Snowflake is clearly selecting for engineers who will not ship a quadratic solution when the prompt tells them to be linear.

Problem 1: Longest Consecutive Sequence

Problem: Given an unsorted array of integers, return the length of the longest consecutive-integer run that can be formed from its elements. The prompt was explicit that the target runtime is O(n), which immediately rules out sorting.

I put everything into a hash set, then iterated the set once and, for each element that was the start of a run (no predecessor in the set), walked forward until the run broke. That is the standard trick: the outer loop is O(n) and the inner walk is amortized O(n) because each element is visited at most twice across both loops. The test cases included the empty array, a single-element array, and a case with heavy duplicates, all of which the hash-set approach handles naturally. This felt like a warmup, closer in spirit to than to anything truly novel, and I was done with about 70 minutes still on the clock.

The only subtlety I caught on review was that using a plain sorted traversal in Python would have been easy to write and still fast enough for most of the grading cases, but it would have failed the explicit O(n) requirement on the largest hidden test. The prompt calling out complexity is itself the hint.

Problem 2: Group Anagrams

Problem: Given a list of strings, group together all strings that are anagrams of each other. The order of the output groups does not matter.

I took the character-count approach instead of the sort-as-key approach. Each string becomes a 26-element tuple of lowercase letter counts, which is the dictionary key, and I appended into a defaultdict of lists. That is O(n k) where k is the average string length, versus O(n k log k) for the sort-as-key version. The saving probably does not matter at the input sizes Snowflake was testing, but the question obviously rewards you for noticing the improvement, which I called out in a comment. A problem like has the same flavor of "the obvious answer passes, the slightly smarter answer is what they are grading." I shipped it and moved on.

One edge case I specifically tested: inputs that include an empty string. My solution handled it correctly (the empty string becomes the all-zeros tuple and groups with other empty strings), but I added an explicit test because the sample cases did not include it.

Problem 3: Rotate Image

Problem: Given an n by n 2D matrix representing an image, rotate it 90 degrees clockwise. The rotation must happen in place. No additional O(n^2) storage is allowed.

The clean two-step solution is to transpose the matrix (swap A[i][j] with A[j][i] for i < j) and then reverse each row. I wrote the transpose carefully because it is the kind of code where an off-by-one index swaps elements twice and undoes itself. The reversal per row is trivial. The combined pass is O(n^2) time, O(1) extra space, which meets the in-place constraint.

The interviewer does not exist in an OA, but the prompt called out the space constraint explicitly, which is the OA equivalent of the interviewer pushing on your approach. I added a note in a comment about why this works: transpose reflects along the main diagonal and the row reverse flips horizontally, which composes to a 90-degree clockwise rotation. I would rather the grader see that I understand why it works than guess I memorized the recipe. Problems like reward the same kind of constraint-first thinking, where the space or time bound is the hint about which data structure to reach for.

The only part of this problem that slowed me down was the input parsing. The sample matrix was provided as a Python-style list of lists, but the parser was strict about whitespace inside the row literals, and my first attempt died on a parsing error. I rewrote the reader to strip aggressively and it went through.

Problem that did not appear but I had prepared for

I had spent prep time on a tree problem in the shape of and on a topological-sort problem similar to , on the theory that a data-platform company would test graph and tree fundamentals. Neither appeared on my OA. I would still recommend preparing them, because the pool rotates and tree or graph problems show up in at least half of the reported Snowflake OA experiences I found.

Result

Still waiting. I finished the OA well inside the time limit and all three visible sample cases passed on my final submission, but the hidden grading set is opaque. The recruiter told me decisions go out in two to three weeks, so I will update if and when I hear back. I am cautiously optimistic on problems one and three and less certain on problem two, mostly because I did not stress-test the hash-map collision behavior on larger inputs.

Tips

  1. Treat complexity prompts as hard constraints. When Snowflake says O(n), they mean it, and the hidden test case at scale will catch the O(n log n) solution. This is the single most common way to lose points on their OA.
  2. Prefer count-based hashing over sort-based hashing for anagram-style grouping. It is a small optimization but it is exactly the kind of detail the grading rubric rewards.
  3. Always write the in-place solution when space is constrained. Do not reach for a new matrix and then try to optimize later. On rotate-image, the transpose-plus-reverse pattern is the expected answer and the one their test harness was designed around.
  4. Pad the edge-case coverage yourself. Empty inputs, single elements, duplicates, and whitespace-heavy strings are the things the sample cases conveniently leave out. Write two or three of your own before submitting.
  5. Budget 30-30-30 on a three-problem 90-minute OA. Do not overspend on problem one just because it is comfortable. The third problem is where most candidates run out of time, and that is where the constraint-heavy tests live.
  6. Prep trees and topological sort even if they do not show up. The pool is wider than the three problems you will see, and a single missed problem in this OA closes the door.