You are given prices, where prices[i] is the price of one stock on day i. You may hold at most one share at a time, and you must buy before you sell. The round is one problem that the interviewer escalates in three graded parts, each asked after you finish…