-
-
Save amankharwal/ce9583e549fa3a3850c1d401d82ef55e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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