BEATS 98% Memory !!! Solution in cpp !!! Easy solution
Intuition\n Describe your first thoughts on how to solve this problem. \nJust brute approach \n# Approach\n Describe your approach to solving the problem. \nWe 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nJust brute approach \n# Approach\n<!-- Describe your approach to solving the problem. -->\nWe need to just focus on the part of the worker and the difficulty array , rest is easy. We have to see if a worker can do a work or not (ability >= difficulty) and then when it is true , we have to aquire the maximum profit of all the works that he/her is qualified for.Now we simply add these profits and display result. \n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n2 loops are used so time complexity is O(N*M)(N=size of woker array, M=size of profit array)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(1) constant space complexity for this solution\n```javascript []\nconsole.log(\'Hello world!\')\n```javascript []\nconsole.log(\'Hello world!\')\n```javascript []\nconsole.log(\'Hello world!\')\n```javascript []\nconsole.log(\'Hello world!\')\n```javascript []\nconsole.log(\'Hello world!\')\n```javascript []\nconsole.log(\'Hello world!\')\n```\n```python []\nprint(\'Hello world!\')\n```\n```ruby []\nputs \'Hello world!\'\n```\n```\n```python []\nprint(\'Hello world!\')\n```\n```ruby []\nputs \'Hello world!\'\n```\n```\n```python []\nprint(\'Hello world!\')\n```\n```ruby []\nputs \'Hello world!\'\n```\n```\n```python []\nprint(\'Hello world!\')\n```\n```ruby []\nputs \'Hello world!\'\n```\n```\n```python []\nprint(\'Hello world!\')\n```\n```ruby []\nputs \'Hello world!\'\n```\n```\n```python []\nprint(\'Hello world!\')\n```\n```ruby []\nputs \'Hello world!\'\n```\n\n# Code\n```\nclass Solution {\npublic:\n    int maxProfitAssignment(vector<int>& difficulty, vector<int>& profit, vector<int>& worker) {\n        int sum_profit=0;\n        int max_profit=0;\n        bool flag=false;\n        for(int i=0;i<worker.size();i++){\n            for(int j=0;j<difficulty.size();j++){\n                if(worker[i]>=difficulty[j]){\n                    max_profit=max(max_profit,profit[j]);\n                    flag=true;\n                }\n            }\n            if(flag==true){\n                sum_profit+=max_profit;//4+96+90\n            }\n            flag=false;\n            max_profit=0;\n        }\n    return sum_profit;\n    }\n};\n```
['C++']