Description
Submission
class Solution { public: int minimumEffort(vector<vector<int>>& tasks) { sort(tasks.begin(), tasks.end(), [](vector<int>& a, vector<int>&b) { return a[1] - a[0] < b[1] - b[0]; }); int start = 0; for(auto& t: tasks) { start = max(start + t[0], t[1]); } return start; } };