We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I am using Python 3 and used combinations, but for some reason I am getting a timed out on some test cases:
defmaximumProfit(p):## Write your code here.#max=-99999temp=0iflen(p)<3:return-1c=list(combinations(p,3))foriinc:ifi[2]>i[1]andi[1]>i[0]:temp=i[0]*i[1]*i[2]iftemp>max:max=tempifmax==-99999:return-1else:return(max)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Maximizing the Profit
You are viewing a single comment's thread. Return to all comments →
I am using Python 3 and used combinations, but for some reason I am getting a timed out on some test cases: