Software Engineer • Staff-Level
Software Engineer • Staff-Level
High QualityPractice Other Questions that Snowflake Asked
Continue with targeted prep from Snowflake's coding question bank and system design questions.
Interview Summary
The coding question involved finding the minimum distance between people and cakes in a one-dimensional array, followed by a greedy matching extension that was more confusing than the original problem.
The system design question was TinyURL, with an emphasis on ensuring that the same long URL maps to a unique short URL. This introduced discussions about expiration policies, duplicate requests, and concurrent URL creation. Overall, the difficulty was relatively easy, although the coding follow-up took some time to understand.
Interview Details
Coding — Minimum Distance Between People and Cakes
The first coding problem involved a one-dimensional array containing three possible values. Given an array A of length n, every element is one of the following:
0: An empty position.1: A person.2: A cake.
The task was to find the minimum index distance between any person and any cake in the array. The distance between two positions is defined as the absolute difference between their indices. The objective was to return the smallest possible distance among all person-cake pairs.
-
Follow-Up — Greedy Assignment of Cakes to People
The interviewer then extended the problem from finding a single minimum distance to calculating the total distance across multiple assignments. The updated problem assumed that at each step, there would be a unique nearest person-cake pair. The task was to repeatedly make greedy assignments based on the closest available person and cake, then calculate the total distance across all assignments.
The interviewer emphasized that this was a greedy process rather than a dynamic programming
Unlock Full Details
Create a free account to unlock this interview experience report.