Sort Only, simple Solution, beats 95%
Intuition\nWe sort the tasks by the differential between actual and minimum. Then the smallest differential will be the latest tasks we finished. Because we wan
# Intuition\nWe sort the tasks by the differential between actual and minimum. Then the smallest differential will be the latest tasks we finished. Because we want the remain energy as fewer as better. Then we just choose to add up the actual energy if the remain energy is able to start the task or set the energy to the minimum to start the task in each step.\n\n# Complexity\n- Time complexity: O(nlogn)\n\n- Space complexity: O(1)\n\n# Code\n```\nclass Solution:\n    def minimumEffort(self, tasks: List[List[int]]) -> int:\n    \n        tasks.sort(key = lambda x: x[1]-x[0])\n        energy = 0\n        for task in tasks:\n            if energy + task[0] >= task[1]:\n                energy += task[0]\n            else:\n                energy = task[1]\n\n        return energy\n\n```
['Python3']