SnowFlake Interview Experience - Backend engineer Interview

snowflake logo
snowflake
June 24, 2026 · 1 reads

Summary

I interviewed for a Backend Engineer role at SnowFlake and was asked two coding questions.

Full Experience

Question 1 A forest is represented as a list of integers, where each element stores the index of its parent node.

Rules:

  1. Each node stores its parent’s index in the list.
  2. For a root node, the parent index is the node’s own index.
  3. For any node at index i, its parent index satisfies:

There are no NULL or None values in the list, and the input is always valid.

Example

input: [0, 0, 1, 1, 2]

Visualization: 0 1 3 4 X -> x -> x -> X | 2 x

Please write a function that removes a node from the forest. Note that both the input and output list should satisfy all 3 constraints.

Question 2 You have an N-ary tree (each node can have zero or more children).

The only thing that makes this tree special is that it is distributed — you can assume that each node runs as a separate process living on a totally separate host, and the only way these nodes can communicate is via asynchronous message passing.

Each node has a unique ID.

Each node has a list of the node IDs of its children.

There is a sendAsync method that is provided for you that allows you to dispatch a message to another node.

When a node receives a message that was sent to it, its receive method will be called, indicating which node sent the message and the message itself.

Question: Count the number of nodes in the tree and print the result at the root node.

Given a tree of nodes, like so:

    1
  / | \
 2  3  6
/ \  |

4 5 7

Output: 7

Interview Questions (2)

1.

Remove Node from Forest

Data Structures & Algorithms

A forest is represented as a list of integers, where each element stores the index of its parent node. Each node stores its parent’s index in the list. For a root node, the parent index is the node’s own index. For any node at index i, its parent index satisfies the given constraints. There are no NULL or None values in the list, and the input is always valid. Write a function that removes a node from the forest such that both the input and output list satisfy all three constraints.

2.

Count Nodes in Distributed N-ary Tree

Data Structures & Algorithms

You have an N-ary tree where each node runs as a separate process on a separate host and can only communicate via asynchronous message passing. Each node has a unique ID and a list of child node IDs. A sendAsync method is provided to dispatch messages, and a receive method is called when a node receives a message. Implement a solution to count the number of nodes in the tree and print the result at the root node.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!