Most Easy cpp solution(Beats 100%)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(NLogN)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int minimumEffort(vector<vector<int>>& tasks) \n    {\n        int ans = 0;\n        int energy_left = 0;\n        sort(tasks.begin() , tasks.end() , [&](const vector<int>& a , const vector<int>& b)\n        {\n            return (a[1]-a[0]) > (b[1]-b[0]) ;\n        });\n        //sorting algorithm to sort 2D Array\n        //we have sorted the array in descending order\n\n        for(vector<int> i:tasks)\n        {\n            const int actual = i[0];\n            const int minimum = i[1];\n            if(energy_left<minimum)\n            {\n                ans += minimum - energy_left;\n                energy_left = minimum - actual;\n            }\n            else\n            {\n                energy_left = energy_left - actual;\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']