C# Binary search
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(n logn)\n\n- Space complexity:\nO(n)\n\n# Code\n```\npublic class SnapshotArray {\n\n    public List<List<(int, int)>> List;\n\n    public int CurrentSnap = 0;\n\n    public SnapshotArray(int length) {\n        List = new List<List<(int, int)>>(length);\n        for (int i = 0; i < length; i++)\n        {\n            List.Add(new List<(int, int)>());\n            List[i].Add((0, 0));\n        }\n    }\n    \n    public void Set(int index, int val) {\n        List[index].Add((CurrentSnap, val));\n    }\n    \n    public int Snap() {\n        CurrentSnap++;\n        return CurrentSnap - 1;\n    }\n    \n    public int Get(int index, int snap_id) {\n        var values = List[index];\n\n        // find max snapshot, which is <= snap_id\n\n        var l = 0;\n        var r = values.Count - 1;\n        while (l < r)\n        {\n            var mid = (l + r + 1) / 2;\n            if (values[mid].Item1 <= snap_id)\n            {\n                l = mid;\n            }\n            else\n            {\n                r = mid - 1;\n            }\n        }\n\n        return values[l].Item2;\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#']