Buy and sell Stocks-2 tran allowed | Module : DP and Greedy | In Hindi | C++ | Video_29

preview_player
Показать описание
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,
Question Name:
Buy And Sell Stocks - Two Transactions Allowed
Question Statement:
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).
Used #DataStructure: #DynamicProgramming #tabulation
#TimeComplexity: O(N)
#SpaceComplexity: O(1)
-------------
Similar Questions:
1. Buy and sell Stocks-1 tran allowed:
2. Buy And Sell Stocks - Infinite Transactions Allowed
3.Buy And Sell Stocks With Transaction Fee - Infinite Transactions Allowed:
4. Buy And Sell Stocks With Transaction Fee - Infinite Transactions Allowed:
5. Buy And Sell Stocks - K Transactions Allowed:
-----------
Dependent Questions:
1. Buy and sell Stocks-1 tran allowed:
2. Buy And Sell Stocks - Infinite Transactions Allowed
3. Buy And Sell Stocks With Transaction Fee - Infinite Transactions Allowed:
4. Buy And Sell Stocks With Transaction Fee - Infinite Transactions Allowed:

More Youtube PlayList:

--------------
We also provide professional courses with live classes and placement opportunities.

.
.
.
Happy Programming !!! Pep it up
------------------
#Arrays #Functions #2DArray #Recursion #DP #Tabular
Рекомендации по теме