1
var SnapshotArray = function (length) {
2
this.snaps = [];
3
this.currentIndex = 0;
4
this.currentSnaps = [];
5
};
6

7
SnapshotArray.prototype.set = function (index, val) {
8
this.currentSnaps[index] = val;
9
};
10

11
SnapshotArray.prototype.snap = function () {
12
this.snaps[this.currentIndex] = [...this.currentSnaps];
13

14
return this.currentIndex++;
15
};
16

17
SnapshotArray.prototype.get = function (index, snap_id) {
18
const res = this.snaps[snap_id];
19

20
if (res[index] === undefined) return 0;
21

22
return res[index];
23
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0