Java HashMap + Two pointer + Sort
\nclass Solution {\n    public int maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) {\n        if (difficulty == null || profit == null || work
```\nclass Solution {\n    public int maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) {\n        if (difficulty == null || profit == null || worker == null) {\n            return 0;\n        }\n        \n        int res = 0;\n        Map<Integer, Integer> dict = new HashMap<>();\n        for (int i = 0; i < difficulty.length; i++) {\n            // duplicate difficulty may have different profits\n            dict.put(difficulty[i], Math.max(dict.getOrDefault(difficulty[i], 0), profit[i]));\n        }\n        \n        Arrays.sort(difficulty);\n        Arrays.sort(worker);\n        \n        int j = 0;\n        int max = 0;\n        for (int i = 0; i < worker.length; i++) {\n            while (j < difficulty.length && worker[i] >= difficulty[j]) {\n                max = Math.max(max, dict.get(difficulty[j]));\n                j++;\n            }\n            res += max;\n        }\n        \n        return res;\n    }\n}\n```
[]