[Python] Binary search solution
Greedily test an initial energy value and use binary search to span over all the possible initial values.\n\n\nclass Solution:\n    def minimumEffort(self, task
Greedily test an initial energy value and use binary search to span over all the possible initial values.\n\n```\nclass Solution:\n    def minimumEffort(self, tasks: List[List[int]]) -> int:\n        \n        def enough(en):\n            for actual, minim in tasks:\n                if en >= minim:\n                    en -= actual\n                else:\n                    return False    \n            return True\n        \n        tasks.sort(key = lambda x: (x[1] - x[0]), reverse=True)\n\n        left = sum([actual for actual, minim in tasks])\n        right = sum([minim for actual, minim in tasks])\n        \n        while left < right:\n            mid = left + (right - left) // 2\n            if enough(mid):\n                right = mid\n            else:\n                left = mid+1\n        \n        return left\n```
[]