> For the complete documentation index, see [llms.txt](https://ayushkumar-21je0209s-organizatio.gitbook.io/untitled/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayushkumar-21je0209s-organizatio.gitbook.io/untitled/dp/advanced/buy-and-sellstock/buy-and-sell.md).

# Buy ans Sell Stock has many type of variations.

## 1. Buy and Sell Stock I -> Only 1 transaction is allowed. [Code](https://github.com/AyushKumar123456789/DSA/blob/master/DP/Advanced/Buy\&SellStock/Buy\&Sell1.cpp)

## 2. Buy and Sell Stock II -> Infinite transactions are allowed. [Code](https://github.com/AyushKumar123456789/DSA/blob/master/DP/Advanced/Buy\&SellStock/BuyAndSell2.cpp)

## 3. Buy and Sell Stock III -> At most 2 transactions are allowed. [Code](https://github.com/AyushKumar123456789/DSA/blob/master/DP/Advanced/Buy\&SellStock/Buy\&Sell3.cpp)

## 4. Buy and Sell Stock IV -> At most k transactions are allowed. [Code](https://github.com/AyushKumar123456789/DSA/blob/master/DP/Advanced/Buy\&SellStock/Buy\&Sell4.cpp)

## 5. Buy and Sell Stock with Cooldown -> At most 1 transaction is allowed with a cooldown period of one day means you can't sell at index i and buy again at index i+1, but you can make as many transaction as possible. [Code](https://github.com/AyushKumar123456789/DSA/blob/master/DP/Advanced/Buy\&SellStock/Buy\&SellCoolDown.cpp)

## 6. Buy ans Sell Stock with transaction fee [Code](https://github.com/AyushKumar123456789/DSA/blob/master/DP/Advanced/Buy\&SellStock/Buy\&SellWithTransactionFee.cpp)

## 7. Buy I stocks on ith day [Code](https://github.com/AyushKumar123456789/DSA/blob/master/DP/Advanced/Buy\&SellStock/Buy_I_Stock_on_ith_day.cpp)

## 8. Buy Maximum Stocks if i stocks can be bought on i-th day [Code](https://github.com/AyushKumar123456789/DSA/blob/master/DP/Advanced/Buy\&SellStock/Buy_I_Stock_on_ith_day.cpp)

## 9. Stock Span Problem [Code](https://github.com/AyushKumar123456789/DSA/blob/master/DP/Advanced/Buy\&SellStock/StockSpan.cpp)
