From 1f8d0e9729aa2deaac0afd20bb2f5f873a99cd7e Mon Sep 17 00:00:00 2001 From: chayan das <110921638+Chayandas07@users.noreply.github.com> Date: Tue, 18 Jun 2024 10:42:40 +0530 Subject: [PATCH] Create 826. Most Profit Assigning Work --- 826. Most Profit Assigning Work | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 826. Most Profit Assigning Work diff --git a/826. Most Profit Assigning Work b/826. Most Profit Assigning Work new file mode 100644 index 0000000..abaaab7 --- /dev/null +++ b/826. Most Profit Assigning Work @@ -0,0 +1,30 @@ +class Solution { +public: + int maxProfitAssignment(vector& difficulty, vector& profit, vector& worker) { + int n = worker.size(); + sort(worker.begin(),worker.end()); + vector> nums(n); + + for(int i=0;i0 && nums[j-1].first <= worker[i]) + { + maxProfit = maxProfit + tempProfit; + } + } + return maxProfit; + } +};