JAVA Sol Beats 100 % submission
``` \npublic int maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) {\n        \n        int max1 = 0, max2 = 0, maxDp = 0;\n        int maxProfi
``` \npublic int maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) {\n        \n        int max1 = 0, max2 = 0, maxDp = 0;\n        int maxProfit = 0;\n        for (int i = 0 ; i < worker.length ; i++) {\n           max1 = Math.max(worker[i], max1); \n        }\n        \n        for (int j = 0 ; j < difficulty.length ; j++) {\n           max2 = Math.max(difficulty[j], max2); \n        }\n        \n        maxDp = Math.max(max1 + 1, max2 +1) ;\n        \n        int[] dp = new int[maxDp];\n        \n        for (int i = 0 ; i < difficulty.length ; i++) {\n            dp[difficulty[i]] = Math.max(dp[difficulty[i]], profit[i]);\n        }\n        \n        for (int i = 1 ; i < dp.length ; i++) {\n            dp[i] = Math.max(dp[i], dp[i-1]);\n        }\n        \n        for (int work: worker) {\n            maxProfit += dp[work];\n        }\n        \n        return maxProfit;\n    }
[]