Best Time to Buy and Sell Stocks with Transaction Fee and Infinite Transactions Dynamic Programming

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024
  • 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 third problem of the buy and sell stock question series where we are required to obtain the maximum profit from buying and selling stocks where each transaction involves a fee.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: www.pepcoding....
    For a better experience and more exercises, VISIT: www.pepcoding....
    #dynamicprogramming
    Have a look at our result: www.pepcoding....
    Follow us on our FB page: / pepcoding
    Follow us on Instagram: / pepcoding
    Follow us on LinkedIn: / pepcoding-education

Комментарии • 182