C++ greedy solution
\nstatic bool compare(vector<int>& left, vector<int>& right){\n        if(left[1] - left[0] == right[1] - right[0])\n        {\n            return left[0] > rig
```\nstatic bool compare(vector<int>& left, vector<int>& right){\n        if(left[1] - left[0] == right[1] - right[0])\n        {\n            return left[0] > right[0]; \n        }\n        return left[1] - left[0] < right[1] -right[0];\n    }\n    int minimumEffort(vector<vector<int>>& tasks) {\n        sort(tasks.begin(), tasks.end(), compare);\n        int energy=0;\n        for(auto task : tasks){\n            energy+=task[0];\n            energy = max(energy, task[1]);\n        }\n        return energy;\n    }\n```
[]