C++ Solution using hashmap
\nclass SnapshotArray {\npublic:\n    unordered_map<int,int> snapArray;  // it stores <index, val>\n    unordered_map<int,unordered_map<int,int>> mp;  // it sto
```\nclass SnapshotArray {\npublic:\n    unordered_map<int,int> snapArray;  // it stores <index, val>\n    unordered_map<int,unordered_map<int,int>> mp;  // it stores <id, map<index,val>>\n    int id;\n    \n    SnapshotArray(int length) {\n        id = 0;\n    }\n    \n    void set(int index, int val) {\n        snapArray[index] = val;\n    }\n    \n    int snap() {\n        mp[id] = snapArray;\n        return id++;\n    }\n    \n    int get(int index, int snap_id) {\n        return mp[snap_id][index];\n    }\n};\n```
['C']