С++ || simple and tasteful
Solution() time complexity: O(m\xD7log(m))\n- pick() time complexity: O(log(m))\n\nm - size of blacklist\n\nclass Solution {\nprivate:\n\tvector<int>& _blacklis
- Solution() time complexity: $$O(m\xD7log(m))$$\n- pick() time complexity: $$O(log(m))$$\n\n$$m$$ - size of blacklist\n```\nclass Solution {\nprivate:\n\tvector<int>& _blacklist;\n\tint total;\npublic:\n\tSolution(int n, vector<int>& blacklist) : _blacklist(blacklist), total(n - blacklist.size()) {\n    \tsort(_blacklist.begin(), _blacklist.end());\n\t}\n\n\tint pick() {\n\t\tint desired = rand() % total;\n\t\tint left = -1;\n\t\tint right = _blacklist.size();\n\t\twhile ((left + 1) < right) {\n\t\t\tint mid = (left + right) / 2;\n\t\t\tif (_blacklist[mid] - mid > desired)\n\t\t\t\tright = mid;\n\t\t\telse\n\t\t\t\tleft = mid;\n\t\t}\n\t\treturn desired + left + 1;\n\t}\n};\n```
['C++']