Search⌘ K
AI Features

DIY: Snapshot Array

Explore how to implement a Snapshot Array data structure in Rust that allows setting values, taking snapshots, and retrieving historical values by snapshot ID. This lesson guides you through managing indexed data efficiently with version control, equipping you to handle related coding interview questions.

Problem statement

In this challenge, you have to implement a Snapshot with the following properties:

  • new(length): This property initializes a data structure with length number of indexes. Initially, the value at each index is 0.

  • ...