Greedy || C++
\n# Code\n\nclass Solution {\npublic:\n    int minimumEffort(vector<vector<int>>& tasks) {\n        sort(tasks.begin(),tasks.end(),[](const vector<int>&a,const 
\n# Code\n```\nclass Solution {\npublic:\n    int minimumEffort(vector<vector<int>>& tasks) {\n        sort(tasks.begin(),tasks.end(),[](const vector<int>&a,const vector<int>& b){\nreturn (a[1]-a[0])>(b[1]-b[0]);});\n        int ans=0;\n        int intial=0;\n        for(int i=0;i<tasks.size();i++){\n            if(intial<tasks[i][1]){\n                ans+=tasks[i][1]-intial;\n                intial=tasks[i][1];\n            }\n            intial-=tasks[i][0];\n        }\n        return ans;\n    }\n};\n```
['Greedy', 'Sorting', 'C++']