[JAVA] Easy, Clean and Concise Solution using Array of HashMap
\nclass SnapshotArray {\n\tHashMap<Integer, Integer>[] snaps;\n\tint snapno;\n\n    public SnapshotArray(int length) {\n        snaps = new HashMap[length];\n  
```\nclass SnapshotArray {\n\tHashMap<Integer, Integer>[] snaps;\n\tint snapno;\n\n    public SnapshotArray(int length) {\n        snaps = new HashMap[length];\n        for(int i = 0; i < length; i++)\n            snaps[i] = new HashMap<>();\n        snapno = 0;\n    }\n    \n    public void set(int index, int val) {\n        snaps[index].put(snapno, val);\n    }\n    \n    public int snap() {\n        snapno++;\n        return snapno - 1;\n    }\n    \n    public int get(int index, int snap_id) {\n        while(snap_id >= 0){\n            if(snaps[index].containsKey(snap_id))\n                return snaps[index].get(snap_id);\n            else\n                snap_id--;\n        }\n        return 0;\n    }\n}\n```
['Java']