Maximum Profit of Operating a Centennial Wheel LeetCode solution in Python
1import sys23MIN_INT = -sys.maxsize - 1456class Solution:7def minOperationsMaxProfit(8self, customers: List[int], boardingCost: int, runningCost: int9) -> int:10maxx = MIN_INT11rotate = total = ans = money = num = i = 012for i in range(len(customers)):13total += customers[i]14rotate = i + 115if total >= 4:16num += 417total -= 418else:19num += total20total = 021money = num * boardingCost - rotate * runningCost22if maxx < money:23maxx = money24ans = rotate25i += 126while total > 0:27rotate = i + 128if total >= 4:29num += 430total -= 431else:32num += total33total = 034money = num * boardingCost - rotate * runningCost35if maxx < money:36maxx = money37ans = rotate38i += 139if maxx < 0:40return -141return ans