100% Faster in C# Solutions
\npublic class SnapshotArray {\n\n           private int SnapID = 0;\n            private Dictionary<int, int>[] dicArray;\n\n            public SnapshotArray(i
```\npublic class SnapshotArray {\n\n           private int SnapID = 0;\n            private Dictionary<int, int>[] dicArray;\n\n            public SnapshotArray(int length)\n            {\n                dicArray = new Dictionary<int, int>[length];\n            }\n\n            public void Set(int index, int val)\n            {\n                if (dicArray[index] == null)\n                    dicArray[index] = new Dictionary<int, int>();\n\n                if (dicArray[index].ContainsKey(SnapID))\n                    dicArray[index][SnapID] = val;\n                else dicArray[index].Add(SnapID, val);\n            }\n\n            public int Snap()\n            {\n                return SnapID++;\n            }\n\n            public int Get(int index, int snap_id)\n            {\n                if (dicArray[index] == null)\n                    return 0;\n\n                if (dicArray[index].ContainsKey(snap_id))\n                    return dicArray[index][snap_id];\n\n                while (!dicArray[index].ContainsKey(snap_id) && snap_id != -1)\n                    snap_id--;\n\n                return snap_id == -1 ? 0 : dicArray[index][snap_id];\n            }\n}\n```
[]