[C#] Simple binary search
Approach\nPosition of the searched element is always even. We can find the position by using binary search.\n\nTime complexity: O(log(n)) Space complexity: O(1)
# Approach\nPosition of the searched element is always even. We can find the position by using binary search.\n\nTime complexity: $$O(log(n))$$ Space complexity: $$O(1)$$\n\n# Code\n```\npublic class Solution {\n    public int SingleNonDuplicate(int[] nums) {\n        int l = 0, r = nums.Length / 2;\n        while (l < r)\n        {\n            var mid = (l + r) / 2;\n            if (nums[mid * 2] == nums[mid * 2 + 1])\n                l = mid + 1;\n            else\n                r = mid;\n        }\n\n        return nums[l * 2];\n    }\n}\n```
['C#']