Easy to understand re-mapping.
\nclass Solution {\n    Map<Integer, Integer> map;\n    Random random = new Random();\n    int bound;\n    public Solution(int N, int[] blacklist) {\n        ma
```\nclass Solution {\n    Map<Integer, Integer> map;\n    Random random = new Random();\n    int bound;\n    public Solution(int N, int[] blacklist) {\n        map = new HashMap<Integer, Integer>();\n        bound = N-blacklist.length;\n        \n        Set<Integer> set = new HashSet<>();\n        for (int i: blacklist){\n            set.add(i);\n        }\n        int idx = N-1;\n        for (int i: blacklist){\n            if (i < N-blacklist.length){\n                while(set.contains(idx)){\n                    idx--;\n                }\n                map.put(i, idx);\n                idx--;\n            }\n        }\n    }\n    \n    public int pick() {\n        int r = random.nextInt(bound);\n        return map.getOrDefault(r, r);\n    }\n}\n```
[]