Search⌘ K
AI Features

DIY: Snapshot Array

Explore how to implement the SnapShotArray class in C# with methods for setting values, taking snapshots, and retrieving past values by snapshot ID. Understand a practical data structure used to track changes over time, helping you develop problem-solving skills applicable to coding interviews.

Problem statement

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

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

  • setValue(idx,val) ...