package leetcode;

/**
 * https://leetcode.com/problems/most-profit-assigning-work/
 */
public class Problem826 {
    public int maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem826 prob = new Problem826();
        System.out.println(prob.maxProfitAssignment(new int[]{2, 4, 6, 8, 10},
            new int[]{10, 20, 30, 40, 50}, new int[]{4, 5, 6, 7})); // 100
        System.out.println(prob.maxProfitAssignment(new int[]{2, 4, 6, 8, 10},
            new int[]{10, 5, 30, 40, 50}, new int[]{4, 5, 6, 7})); // 80
    }
}

@@ -12,16 +12,71 @@
 tcode;%0A%0A
+import java.util.Arrays;%0Aimport java.util.Comparator;%0A%0A
 /**%0A * h
@@ -273,17 +273,842 @@
     
-return 0;
+DifficultyProfit%5B%5D dp = new DifficultyProfit%5Bdifficulty.length%5D;%0A        for (int i = 0; i %3C dp.length; i++) %7B%0A            dp%5Bi%5D = new DifficultyProfit(difficulty%5Bi%5D, profit%5Bi%5D);%0A        %7D%0A        Arrays.sort(dp, Comparator.comparingInt(a -%3E a.difficulty));%0A        int maxProfit = 0;%0A        for (int i = 0; i %3C dp.length; i++) %7B%0A            maxProfit = Math.max(maxProfit, dp%5Bi%5D.profit);%0A            dp%5Bi%5D.profit = maxProfit;%0A        %7D%0A        return 0;%0A    %7D%0A%0A    private static class DifficultyProfit %7B%0A        private final int difficulty;%0A        private int profit;%0A%0A        public DifficultyProfit(int difficulty, int profit) %7B%0A            this.difficulty = difficulty;%0A            this.profit = profit;%0A        %7D%0A%0A        @Override%0A        public String toString() %7B%0A            return difficulty + %22 -%3E %22 + profit;%0A        %7D
 %0A   

Update problem 826