Beginner Friendly || Beats 100% Runtime in CPP || Easiest CPP Solution
IntuitionTukkaApproachBy Aman VishwakarmaComplexity
Time complexity: O(n∗logn)

Space complexity:O(1)
Code
# Intuition
Tukka
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
By Aman Vishwakarma
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: $$O(n*logn)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:$$O(1)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    static bool comp(vector<int>&a,vector<int>&b){
        return (a[1]-a[0])<(b[1]-b[0]);
    }
    int minimumEffort(vector<vector<int>>& tasks) {
        sort(tasks.begin(),tasks.end(),comp);
        int ans=0;
        ans+=tasks[0][1] ;
        for(int i=1;i<tasks.size();i++){
            ans+=tasks[i][0];
            if(ans<tasks[i][1])ans=tasks[i][1];
        }
        return ans;
        

    }
};
```
['Array', 'Sorting', 'C++']