JAVA Solution Explained in HINDI
https://youtu.be/aWWkGvO_r5k\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote 
https://youtu.be/aWWkGvO_r5k\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote the solution if you liked it.\n\n# Subscribe:- [ReelCoding](https://www.youtube.com/@reelcoding?sub_confirmation=1)\n\nSubscribe Goal:- 500\nCurrent Subscriber:- 442\n\n# Complexity\n- Time complexity: O(nlogn+mlogm)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maxProfitAssignment(int[] difficulty, int[] profit, int[] worker) {\n        int n = difficulty.length;\n        int m = worker.length;\n\n        List<int[]> jobs = new ArrayList<>();\n        for (int i = 0; i < n; i++) {\n            jobs.add(new int[]{difficulty[i], profit[i]});\n        }\n\n        // Sort jobs by difficulty, and if they have the same difficulty, by profit\n        jobs.sort((a, b) -> a[0] - b[0]);\n        Arrays.sort(worker);\n\n        int profSum = 0;\n        int maxProfit = 0;\n        int j = 0;\n\n        for (int i = 0; i < m; i++) {\n            while (j < n && jobs.get(j)[0] <= worker[i]) {\n                maxProfit = Math.max(maxProfit, jobs.get(j)[1]);\n                j++;\n            }\n            profSum += maxProfit;\n        }\n\n        return profSum;\n    }\n}\n```
['Java']