Snowflake

1 DSA problems asked in Snowflake coding interviews

0 Easy
1 Medium
0 Hard
​

1 problem

Design
1
Snapshot Array
Medium

Implement `SnapshotArray`, an array-like structure that can take snapshots. - `SnapshotArray(int length)` creates an array of the given length where every element starts as 0. - `void set(index, val)` sets the element at `index` to `val`. - `int snap()` takes a snapshot and returns its `snap_id`, which is the total number of times `snap()` has been called minus 1. - `int get(index, snap_id)` returns the value that `index` held when the snapshot `snap_id` was taken.