✅ beats 100% Java code
Java Code\n\nclass SnapshotArray {\n    int len;\n    List<int[]> shot;\n    int[] list;\n    int snap_id;\n    int maxlen;\n    public SnapshotArray(int length
# Java Code\n```\nclass SnapshotArray {\n    int len;\n    List<int[]> shot;\n    int[] list;\n    int snap_id;\n    int maxlen;\n    public SnapshotArray(int length) {\n        list = new int[length];\n        \n        shot = new ArrayList<>();\n        len = length;\n        snap_id = 0;\n        maxlen = 0;\n    }\n    \n    public void set(int index, int val) {\n        if (index <len) {\n            list[index] = val;\n            maxlen = Math.max(maxlen, index);\n        }\n    }\n    \n    public int snap() {\n        shot.add(Arrays.copyOf(list, maxlen+1));\n        snap_id++;\n        return snap_id-1;\n    }\n    \n    public int get(int index, int snap_id) {\n        int[] shotArray = shot.get(snap_id);\n        if (index >= shotArray.length)\n            return 0;\n        return shotArray[index];\n    }\n}\n```
['Array', 'Hash Table', 'Binary Search', 'Design', 'Java']