100% || 0ms ||TREEMAP OF ARRAY|| easy || simple || fast || concise
\nclass SnapshotArray {\n    TreeMap<Integer, Integer>[] A;\n    int snap_id = 0;\n    public SnapshotArray(int length) {\n        A = new TreeMap[length];\n   
```\nclass SnapshotArray {\n    TreeMap<Integer, Integer>[] A;\n    int snap_id = 0;\n    public SnapshotArray(int length) {\n        A = new TreeMap[length];\n        for (int i = 0; i < length; i++) {\n            A[i] = new TreeMap<Integer, Integer>();\n            A[i].put(0, 0);\n        }\n    }\n\n    public void set(int index, int val) {\n        A[index].put(snap_id, val);\n    }\n\n    public int snap() {\n        return snap_id++;\n    }\n\n    public int get(int index, int snap_id) {\n        return A[index].floorEntry(snap_id).getValue();\n    }\n}\n```
['PHP', 'Python', 'C++', 'Java', 'Go', 'JavaScript']