Best Time to Buy and Sell Stocks - Two Transaction Allowed (Hard) | Dynamic Programming

Описание к видео Best Time to Buy and Sell Stocks - Two Transaction Allowed (Hard) | Dynamic Programming

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. With this video, we explained the buy and sell stock questions of dynamic programming. In this video, we discuss the question where we are required to buy and sell stock with two transactions such that maximum profit is obtained from the transaction. 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 two transactions at-most.
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...
#dynamicprogramming #buysellstocks


Have a look at our result: https://www.pepcoding.com/placements
Follow us on our FB page:   / pepcoding  
Follow us on Instagram:   / pepcoding  
Follow us on LinkedIn:   / pepcoding-education  
Join us on Telegram: https://t.me/joinchat/UVTjJE83a-zFnPB

Комментарии

Информация по комментариям в разработке