Python - greedy approach beats 100%/100%
Intuition\nIt makes sense to minimize the gap between the minimum and the actual. End result of such an operation is either:\n\n1. You have >= minimum for the n
# Intuition\nIt makes sense to minimize the gap between the minimum and the actual. End result of such an operation is either:\n\n1. You have >= minimum for the next activity. Good chance to minimize result\n2. You have < minimum for the next activity, so you just need to top-up.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\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:\n    def minimumEffort(self, tasks: List[List[int]]) -> int:\n        tasks.sort(key = lambda x: x[1] - x[0])\n        current = 0\n        result = 0\n        while tasks:\n            actual, minimum = tasks.pop()\n            if current < minimum:\n                result += minimum - current\n                current = minimum\n            current -= actual\n        return result\n```
['Python3']