binary search c++ standard
\n// you are try to find the k + 1 th white\n\nclass Solution {\nprivate:\n    int N;\n    int b;\n    vector<int> blackList;\npublic:\n    Solution(int N, vect
```\n// you are try to find the k + 1 th white\n\nclass Solution {\nprivate:\n    int N;\n    int b;\n    vector<int> blackList;\npublic:\n    Solution(int N, vector<int>& blacklist) : b(blacklist.size()), N(N), blackList(blacklist) {\n        sort(blackList.begin(), blackList.end());\n        cout<<RAND_MAX<<endl;\n    }\n    \n    int pick() {\n        int k = rand() % (N - b);\n        if (b == 0)\n            return k;\n        if (blackList[0] > k)\n            return k;\n        int start = 0, end = b - 1;\n        while (start <= end) {\n            int mid = (start + end) / 2;\n            int wc = blackList[mid] - mid;\n            if (wc <= k && (mid == b-1 || mid != b-1 && blackList[mid+1] - mid - 1 > k)) {\n                return k + 1 - wc + blackList[mid];\n            } else if (wc > k) {\n                end = mid - 1;\n            } else {\n                start = mid + 1;\n            }\n        }\n        return -1;\n        \n    }\n};\n\n/**\n * Your Solution object will be instantiated and called as such:\n * Solution* obj = new Solution(N, blacklist);\n * int param_1 = obj->pick();\n */\n```
[]