Answer to Question #289223 in Python for sai krishna

Question #289223

Jatin is a college student and he got his first salary from an internship. his plan is to buy one stock on a particular day and then sell it on another day. He can trade (buy & sell) the stock only once. he has one time use magic spell which he used to get the stock prices N future consecutive days. based on this information and his strategy determine the maximum profit he can make. in the given list of price, the price of stock on the ith day is denoted by prices[i]. If there is no profit that can be achieved , return 0.

INPUT -7 1 5 3 6 4

OUTPUT- 5

INPUT- 1 11 13 21 19

OUTPUT- 20


1
Expert's answer
2022-01-20T09:50:05-0500
Dear sai krishna, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS