Best Time to Buy and Sell Stocks - 2 (Infinite Transactions) Dynamic Programming

Pepcoding
Pepcoding
40.5 هزار بار بازدید - 4 سال پیش - Please consume this content on
Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.

NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we discuss the second variation of the buy and sell stock problem series where we are required to find the maximum amount which can be obtained from selling stocks at different prices in infinite transactions. In this problem,

1. You are given a number n, representing the number of days.
2. You are given n numbers, where ith number represents price of stock on ith day.
3. You are required to print the maximum profit you can make if you are allowed infinite transactions.
Note - There can be no overlapping transaction. One transaction needs to be closed (a buy followed by a sell) before opening another transaction (another buy)

To attempt and submit this question, click here: https://www.pepcoding.com/resources/o...

For a better experience and more exercises, VISIT: https://www.pepcoding.com/resources/o...

#
Have a look at our result: https://www.pepcoding.com/placements
Follow us on our FB page: Facebook: pepcoding
Follow us on Instagram: Instagram: pepcoding
Follow us on LinkedIn: LinkedIn: pepcoding-education
4 سال پیش در تاریخ 1399/05/17 منتشر شده است.
40,547 بـار بازدید شده
... بیشتر