C# Solution
\nclass Solution\n{\n    private int whitelistCnt;\n    private Random random;\n    private Dictionary<int, int> dict;\n\n    public Solution(int n, int[] black
```\nclass Solution\n{\n    private int whitelistCnt;\n    private Random random;\n    private Dictionary<int, int> dict;\n\n    public Solution(int n, int[] blacklist)\n    {\n        dict = new Dictionary<int, int>();\n        foreach(int b in blacklist) dict[b] = -1;\n        whitelistCnt = n - dict.Count;\n        foreach (int b in blacklist)\n        { \n            if (b < whitelistCnt)\n            { \n                while (dict.ContainsKey(n - 1))\n                    n--;\n                dict[b] = n - 1;\n                n--;\n            }\n        }\n\n        this.random = new Random();\n    }\n\n    public int Pick()\n    {\n        int p = random.Next(whitelistCnt);\n        return dict.ContainsKey(p) ? dict[p] : p;\n    }\n}\n```
[]