C++|short and simple
\nclass SnapshotArray {\npublic:\n    vector<map<int,int>>A;\n    int s_id = 0;\n    SnapshotArray(int length) {\n        A.resize(length);\n        for(int i =
```\nclass SnapshotArray {\npublic:\n    vector<map<int,int>>A;\n    int s_id = 0;\n    SnapshotArray(int length) {\n        A.resize(length);\n        for(int i = 0; i < length; i++)\n            A[i][0] = 0;\n        \n    }\n    \n    void set(int index, int val) {\n        A[index][s_id] = val;\n    }\n    \n    int snap() {\n        s_id++;\n        return  s_id - 1;\n    }\n    \n    int get(int index, int snap_id) {\n        if(A[index].find(snap_id) == A[index].end())\n        {\n            auto it = --A[index].lower_bound(snap_id);\n            return it->second;\n        }\n        return A[index][snap_id];\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```
['C', 'Binary Tree', 'C++']