Simple JS Solution using Arrays
```\nconst SnapshotArray = function (length) {\n\tthis.data = [];\n\tthis.snaps = [];\n};\n\nSnapshotArray.prototype.set = function (index, val) {\n\tthis.data[
```\nconst SnapshotArray = function (length) {\n\tthis.data = [];\n\tthis.snaps = [];\n};\n\nSnapshotArray.prototype.set = function (index, val) {\n\tthis.data[index] = val;\n};\n\nSnapshotArray.prototype.snap = function () {\n\tthis.snaps.push([...this.data]);\n\treturn this.snaps.length - 1;\n};\n\nSnapshotArray.prototype.get = function (index, snap_id) {\n\tconst value = this.snaps[snap_id][index];\n\treturn value === undefined ? 0 : value;\n};\n
['JavaScript']