[C#] O(N) Two Lines
Algorithm\nStep 1) Sum all the actual costs together and add the smallest difference between minimum and actual (this corresponds to summing all actual costs ex
# Algorithm\nStep 1) Sum all the actual costs together and add the smallest difference between minimum and actual (this corresponds to summing all actual costs excluding your last choice which needs to use minimum)\nStep 2) Make sure it is not greater than largest minimum\n# Code\n```csharp\npublic class Solution {\npublic int MinimumEffort(int[][] tasks)\n        {\n            int sum = tasks.Sum(ints => ints[0]) + tasks.Min((ints => ints[1]-ints[0])); \n            return Math.Max(sum, tasks.Max((ints => ints[1])));\n        }\n}\n```\n\n# Explanation\nDon\'t have a great on at the moment, feel free to maybe discuss and I\'ll update.\nWould involve showing that greedy approach is optimal. Also maybe look at effects of commuting pairs of tasks.
['C#']