C++
\n\npublic:\n    static bool cmp(vector&v1,vector&v2)\n    {\n        return (v1[0]-v1[1])>(v2[0]-v2[1]);\n    }\n    int minimumEffort(vector>& tasks) {\n     
```\n\n```public:\n    static bool cmp(vector<int>&v1,vector<int>&v2)\n    {\n        return (v1[0]-v1[1])>(v2[0]-v2[1]);\n    }\n    int minimumEffort(vector<vector<int>>& tasks) {\n        sort(tasks.begin(),tasks.end(),cmp);\n        int i,sum=0;\n        for(i=0;i<tasks.size();i++)\n        {\n            sum=max(tasks[i][1],tasks[i][0]+sum);\n        }\n        return sum;\n    }\n};
[]