Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created March 24, 2021 07:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
class MaximumProfitFinder:
def maximumProfit(self, list, fees):
def cost(i, n, prev):
if i >= n:
return 0
elif prev == True:
return max(cost(i+1, n, False) + prices[i] - fees, cost(i + 1, n, prev))
else:
return max(cost(i+1, n, True) - prices[i], cost(i + 1, n, prev))
return cost(0, len(prices), False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment