EASY SOLUTION 😊||🔥JAVA
\n\n# Code\n\nclass SnapshotArray {\n    TreeMap<Integer, Integer>[] A;\n    int snap_id = 0;\n    public SnapshotArray(int length) {\n        A = new TreeMap[l
\n\n# Code\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\n/**\n * Your SnapshotArray object will be instantiated and called as such:\n * SnapshotArray obj = new SnapshotArray(length);\n * obj.set(index,val);\n * int param_2 = obj.snap();\n * int param_3 = obj.get(index,snap_id);\n */\n```
['Java']