Best Time to Buy and Sell Stocks - K Transaction Allowed Dynamic Programming

Sdílet
Vložit
  • čas přidán 7. 08. 2020
  • 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 K 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 given a number k, representing the number of transactions allowed.
    3. You are required to print the maximum profit you can make if you are allowed k 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: www.pepcoding.com/resources/o...
    For a better experience and more exercises, VISIT: www.pepcoding.com/resources/o...
    #dynamicprogramming #buysellstocks
    Have a look at our result: 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: t.me/joinchat/UVTjJE83a-zFnPB

Komentáře • 183

  • @brijpatel237
    @brijpatel237 Před 3 lety +124

    Though you were not in the top search list, still we all came here :-P , it's just the quality that drags us all down here. Awesome Sir!

    • @Pepcoding
      @Pepcoding  Před 3 lety +55

      Thankyou beta, I am glad.
      With the love and respect which I get from you people one day we will surely reach heights and touch the sky.
      Keep on supporting and loving Pepcoding😊

    • @ajitshiva3282
      @ajitshiva3282 Před 3 lety +1

      True

  • @imranwahid9871
    @imranwahid9871 Před 3 lety +25

    Sir nobody can explain like you. True legend.

    • @Pepcoding
      @Pepcoding  Před 3 lety +3

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

    • @sumitshokeen4065
      @sumitshokeen4065 Před 2 lety

      @@Pepcoding Thank You Sir

  • @ameerzeya5460
    @ameerzeya5460 Před 3 lety +3

    Hats off respect Sir, how much effort you put in each video especially like this one so we can understand easily, you are a god gift to us.

  • @kshitijsharma6471
    @kshitijsharma6471 Před 2 lety

    Best Explanation of this Problem. Thank You For such an amazing explanation.

  • @khemendrabhardwaj2552
    @khemendrabhardwaj2552 Před rokem +1

    Best Explaination of any dp concept till yet
    Thanks for sharing for knowledge

  • @hardworkingboy9737
    @hardworkingboy9737 Před 3 lety +4

    This is Absolutely Gold content Available here for free, I wish someday I can become as good a teacher as you are .

  • @riyagoyal8863
    @riyagoyal8863 Před 2 lety

    sir I want to say thanks to you for all your efforts and the free and the best content that you have provided. I really appreciate your work. I also noticed that there are no ads not even at the beginning of any video. You are the best.

  • @princemakadiya9443
    @princemakadiya9443 Před 3 lety +2

    No matter what the difficulty of question is,
    Sir by your explanation, question always seems easy
    Thanks sir!!
    😀

  • @NikhilKumar-vf9nv
    @NikhilKumar-vf9nv Před 4 lety +15

    Thank you Sir, This one question is too much difficuilt and with your explanation i've got that in my head completely,

    • @Pepcoding
      @Pepcoding  Před 4 lety +12

      You are most welcome. Kaash log poori dekhein.

  • @34_harshdeepraghuwanshi98

    That is quality and depth sir . Thanks 🙏

  • @adityaojha2701
    @adityaojha2701 Před 3 lety +1

    Thank god you are here!!

  • @niharika3608
    @niharika3608 Před 3 lety

    Very good content. One of the best on youtube :)

  • @ShivamKumar-qv6em
    @ShivamKumar-qv6em Před 2 lety

    He is all time favourite. No words just hats off to u Sumeet bhaiya

  • @alpishjain1317
    @alpishjain1317 Před 3 lety

    Awesome explanation and optimization!

  • @InderjeetSingh-lb5rk
    @InderjeetSingh-lb5rk Před 3 lety +2

    Best explanation we can get for this sir!! Thankyou and keep posting!!!!

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @abhishekghosh5845
    @abhishekghosh5845 Před 3 lety

    Dil jeet liya Sir. Bohot shukriya itne ache explanation k liye!

    • @Pepcoding
      @Pepcoding  Před 3 lety

      yahi to chaie
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber
      For clearing your doubts, you can join our community on telegram
      t.me/pepcoding

  • @RaghvendraSingh-lp3cd
    @RaghvendraSingh-lp3cd Před 3 lety

    Thank you, sir your all videos are amazing. itna ache se smajh aaya ki, Now I feel like ki stock market ka analysis kar lu.

  • @soumikroy5096
    @soumikroy5096 Před rokem

    Sir, aap itna humble attitude ke sathe itna accha kaise padate ho? Salute for all of your efforts.. I understand hole logic in one go of this video.. Aur pura concept v yaad rakhe ga.. Thank you so much sir..

  • @rahulbhatia3075
    @rahulbhatia3075 Před 3 lety

    Wooowh sir amazing explanation 🔥🔥🔥

  • @navidulhaque3063
    @navidulhaque3063 Před 2 lety

    sir you work so hard ,, your teaching methods are awesome.

  • @AtulSharma-ue7on
    @AtulSharma-ue7on Před 3 lety +5

    Bohot acchi videos hai sir,
    poori series eksath krke accha lag.
    Ekk suggestion hai bas:
    Agar aap thoda variable ke names aur code quality pr bhi help kre to kaafi accha hofa sir.
    Companies aajkal kaafi judge krti hai code quality pr jab hum online coding interview me code kar rhe hote hai to.

  • @kartikaggarwal8520
    @kartikaggarwal8520 Před 3 lety +21

    sir after listening to the whole playlist, i have gained a lot of confidence in this topic, thank u

    • @Pepcoding
      @Pepcoding  Před 3 lety +6

      Glad it was helpful!pdtee rhiee beta ji

  • @techscout4051
    @techscout4051 Před 3 lety

    You are a true legend .

  • @madhurjyasaha6798
    @madhurjyasaha6798 Před 3 lety

    Excellent explanation!
    Sir could you please make a video on the below question:
    There is a rod of length N lying on x-axis with its left end at x = 0 and right end at x = N. Now, there are M weak points on this rod denoted by positive integer values(all less than N) A1, A2, …, AM. You have to cut rod at all these weak points. You can perform these cuts in any order. After a cut, rod gets divided into two smaller sub-rods. Cost of making a cut is the length of the sub-rod in which you are making a cut.
    Your aim is to minimize this cost. Return an array denoting the sequence in which you will make cuts. If two different sequences of cuts give same cost, return the lexicographically smallest.
    For eg,
    N = 6
    A = [1, 2, 5]
    If we make cuts in order [1, 2, 5], let us see what total cost would be.
    For first cut, the length of rod is 6.
    For second cut, the length of sub-rod in which we are making cut is 5(since we already have made a cut at 1).
    For third cut, the length of sub-rod in which we are making cut is 4(since we already have made a cut at 2).
    So, total cost is 6 + 5 + 4.
    Cut order | Sum of cost
    (lexicographically | of each cut
    sorted) |
    ___________________|_______________
    [1, 2, 5] | 6 + 5 + 4 = 15
    [1, 5, 2] | 6 + 5 + 4 = 15
    [2, 1, 5] | 6 + 2 + 4 = 12
    [2, 5, 1] | 6 + 4 + 2 = 12
    [5, 1, 2] | 6 + 5 + 4 = 15
    [5, 2, 1] | 6 + 5 + 2 = 13
    So, we return [2, 1, 5].

  • @gopalsays108
    @gopalsays108 Před 2 lety

    I don't know why this channel is underrated, with fewer subs, and fewer views, though this channel deserves millions of views and subs❤❤💙💙.

  • @amitpurohit8816
    @amitpurohit8816 Před 3 lety

    Terrific explanation!!! Thank you very much!!

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

    • @amitpurohit8816
      @amitpurohit8816 Před 3 lety +1

      @@Pepcoding yes sure

  • @manpreetsinghrana7751

    Legend!!!

  • @AnuSharma02
    @AnuSharma02 Před 3 lety +3

    best coding videos ever, keep creating such content

  • @sakshamkapoor3403
    @sakshamkapoor3403 Před 3 lety +1

    Sir your explanation and thought process are the best
    Pepcoding really makes questions easy

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thank you so much keep learning and keep loving Pepcoding😊

  • @abhinavpratapsingh4445

    Awesome explanation 🤩

  • @adityarathi3420
    @adityarathi3420 Před rokem

    Thank you sir!!

  • @sukritiguin5637
    @sukritiguin5637 Před 2 lety

    Understood sir... Want more and more tutorials and practice questions

  • @pranayghosh1584
    @pranayghosh1584 Před 3 lety

    i'm so blessed to find you :-)

    • @Pepcoding
      @Pepcoding  Před 3 lety +2

      Thanks a lot!! share as much as you can

  • @raj_kundalia
    @raj_kundalia Před rokem

    thank you so much!

  • @sachinsharma905
    @sachinsharma905 Před 3 lety +1

    Sir, kya hi samjhaya aapne ! Thanks.

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @faizan346
    @faizan346 Před 3 lety +1

    i see these type of dp questions can be done in o(n) space by taking 2 1-d array one for current ith row and one for prev i-1th row.

  • @rishabhgoyal2835
    @rishabhgoyal2835 Před 3 lety

    crystal clear explanation : )

  • @ishaankulkarni49
    @ishaankulkarni49 Před 2 lety +1

    no one can teach better than this. 🔥🔥🔥🔥🔥 pepcoding rocks

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Visit nados.pepcoding.com and sign up to NADOS, for better experience, precisely arranged content.
      Don't forget to follow us on Instagram instagram.com/pepcoding/
      Happy Coding!

  • @manubansalcs1003
    @manubansalcs1003 Před 2 lety

    Maza aa gya dear sir.
    Your explanation is like super se bhi upar....
    Keep going forward.
    I have a dream to meet you one day....

  • @joyalmeida6565
    @joyalmeida6565 Před 2 lety

    45 minutes ..totally worth it!

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad it was helpful!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @yashiagrawal9001
    @yashiagrawal9001 Před 3 lety

    You are amazing sir !!, your explanation is toooo gud

  • @himanshunagar1510
    @himanshunagar1510 Před 2 lety +1

    Your explanation is amazing sir

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad you love the explanation, for better experience and well organised content sign up on nados.io and start learning.

  • @ashishkumaryadav5252
    @ashishkumaryadav5252 Před 2 lety

    Nice explanation sir, i like your Hindi language tone.

  • @ashwinnema06
    @ashwinnema06 Před 2 lety

    Nice explanation sir. I saw your brute force approach then I optimized it myself without watching video ahead.

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Good.
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @nitinyadav6731
    @nitinyadav6731 Před 4 lety +6

    My friend samrat told me about you, And you really are great sir..

  • @rahulsingha1654
    @rahulsingha1654 Před 3 lety +2

    Really man, It was the best explanation one can ever give for this question This question is really tough. However, the way you explained made it too easy to understand even for a child and write a code of his own. Really Great!!! please make more and more videos on such hard problems

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Glad it helped and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

    • @rahulsingha1654
      @rahulsingha1654 Před 3 lety

      @@Pepcoding sure man!

  • @hasrat17
    @hasrat17 Před 2 měsíci

    Thanks ❤❤❤

  • @akshaysolanki5164
    @akshaysolanki5164 Před 3 lety

    GOD!!!!! THANKS SIR A LOT.

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like my efforts, I request a review
      g.page/Pepcoding/review?rc

  • @santoshkumar-sh3sb
    @santoshkumar-sh3sb Před 3 lety

    for a transaction to take place 2 days is required so for calculating the kth transaction at i th day it must be max of k th transaction i-1 th day and(k-1 transaction from 0 th day to i-2th day) is this statement valid

  • @himanshusrivastav7738
    @himanshusrivastav7738 Před 3 lety

    I search with the question name then scroll and search for ur image......heights of explanation. How can u explain things so easily?? After watching the explanation I code it by my self and It runs without even a single error. Thanks for all this.

  • @hiteshsahu9431
    @hiteshsahu9431 Před 3 lety +1

    Sir Great Explanation☺☺

    • @Pepcoding
      @Pepcoding  Před 3 lety

      I am glad you liked the video. I also hope that you are watching till end.
      Will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms)

  • @AshishGusain17
    @AshishGusain17 Před 2 lety

    thanks

  • @dipuprasad9196
    @dipuprasad9196 Před 3 lety

    Thank you sir samajh mai aya aur maja bhi aya

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      I am glad you liked it. I also hope that you are watching till the end and trying to understand the what, how, and especially why of the problem.
      If you like our efforts, we request a review - g.page/Pepcoding/review?rc

  • @MonisKhan
    @MonisKhan Před 2 lety

    Thanks!

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Welcome! For more content like this please visit nados.pepcoding.com

  • @sujoyseal195
    @sujoyseal195 Před 3 lety +1

    Sir, why you don't provide code in the description? If possible, please provide the code....it becomes very helpful for us. Understood today's concept. Thank you Sir

  • @peaceandlov
    @peaceandlov Před 3 lety +1

    LEGEND.

  • @GauravKumar-ue7nz
    @GauravKumar-ue7nz Před 2 lety

    Thank you Sir

    • @Pepcoding
      @Pepcoding  Před 2 lety +1

      Most welcome,
      For better experience and well organised content sign up on nados.io
      And for being updated follow us on Instagram instagram.com/pepcoding/

  • @pankajbhatt5169
    @pankajbhatt5169 Před 3 lety +1

    One we frame the recursive solution then implementing DP becomes intuitive like in this we didn't go this way like first thought recursively and then come to DP . In this question that part was not there

  • @dsa3334
    @dsa3334 Před 3 lety

    Thank you so much

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @LegitGamer2345
    @LegitGamer2345 Před 3 lety

    awesome!!

  • @shivangagrawal2923
    @shivangagrawal2923 Před 2 lety

    awesome explanation 🔥

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @ranchhordaschaanchad2623

    Bhai Inka ni ata ni ata ...par achanak se jaise hi ata h ...kya samajh ata h😂.. ❤ great sir luv u

  • @sdeBack1
    @sdeBack1 Před 2 lety +1

    we can also do in O(n) space

  • @umangbehl8152
    @umangbehl8152 Před 2 lety

    i prefer pepcoding videos not matter how big they are than watching web series

  • @spartan1998
    @spartan1998 Před 3 lety

    This is the only good explanation available on internet for this question 😌😌

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review
      g.page/Pepcoding/review?rc
      You can subscribe to our channel here
      czcams.com/users/Pepcodingabout?view_as=subscriber

    • @spartan1998
      @spartan1998 Před 3 lety

      @@Pepcoding yess

  • @anjneykumarsingh4461
    @anjneykumarsingh4461 Před 3 lety

    🏆gold

  • @Aditya-rs5dj
    @Aditya-rs5dj Před 2 lety

    Can we do this question by calculating the sum of top K transaction profits from a list of profits if any number of transactions are allowed???

  • @pranjalpatel256
    @pranjalpatel256 Před 3 lety

    Awesome sir

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Thank you so much Beta and If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @anshrohatgi4202
    @anshrohatgi4202 Před 3 lety

    @Pepcoding bs ye clear koi bta sakta h when to use 1d array when to use 2d array!
    ??

  • @kumarakash5219
    @kumarakash5219 Před 2 lety

    This can be used to solve 2 transiction question

  • @utsavkumar4826
    @utsavkumar4826 Před 2 lety

    why don't we consider arr[i-1][j] while calculating maximum profit as it is possible to buy and sell on the same day. Lets consider we closed our 2 transactions on 5th day, and bought and sold again on the same day. Why wouldn't we consider that while finding max for 3 transactions on 5th day.

  • @sachindeshpande4521
    @sachindeshpande4521 Před 4 lety +1

    Awesome

  • @MDSOHEL-fk3rz
    @MDSOHEL-fk3rz Před 3 lety

    sir one question, will the transaction not overlap

  • @praveenreddychalamalla

    The Dp explanation part is fine, but discuss the recurrence relations before you dive into Dp.

  • @techmind9608
    @techmind9608 Před rokem

    🥳🥳

  • @NDBROTHERS
    @NDBROTHERS Před 4 lety +9

    sir isme ek condition or dal skte h ki if [ k>= (no_of_days/2) ] then ye question infinite transcation allowed wala bn jyega

    • @Pepcoding
      @Pepcoding  Před 4 lety +1

      Yeah, right. Uske baad profit constant rahega.

    • @GymRatShailendraYadav
      @GymRatShailendraYadav Před 3 lety +1

      @@Pepcoding Yes sir this condition is required to pass testcases of large values of k ..otherwise solution wouldn't have accepted.

  • @VISHALSHARMA-wn7if
    @VISHALSHARMA-wn7if Před 2 lety

    1st time mai kuch samajh nhi aya...2nd time mai kuch kuch...3rd time mai kuch se thoda zada...in 4th time...kya mst content hai bhai....comment section kaha hai...hehehehhe...
    Thank you
    Pepcoding nd team...

  • @arnabmallik7978
    @arnabmallik7978 Před 3 lety

    Thank you!! very nice explanation. One question, can we solve the previous question (b&s stocks2 transactions allowed) with this dp method??

  • @harshitkaushik4144
    @harshitkaushik4144 Před 3 lety

    sir aap logo ne comapny ke tags remove kar die hai update ke baad site pe, please unhe vapas la dijiye taki pata rahe questions konsi kopnsi comapnies me puche gaye hai

  • @dhanyaabharadwaj1376
    @dhanyaabharadwaj1376 Před 3 lety +2

    Sir, what about questions which can come as a combination of all the buy and sell stocks, like for eg, k transactions with cooldown/transaction fee?

    • @Pepcoding
      @Pepcoding  Před 3 lety +15

      aap soch ke dekhie ek baar. Mujhe k transaction with cooldown ek second mei samajh aa rha hai agar mujhe dono question aate hain to. Similarly transaction fee with cooldown bhi bhot araam se samajh aa rha hai jab 2no question aate ho to.
      aur teeno ka combination bhi easy lag rha hai.
      Suno, aap teeno ko individually karo. Firr meditate karo aur dry run karo, ki cooldown+fee hota to kya hota, fee+ktransaction hota to kya hota, cooldown+ktransaction hota to kya hota. Ab teeno sath soch kar dekhie.
      Teeno questions ko individually kijie ek baar. teeno ka video available hai. Uske baad combination mujhe to simple lag rha hai. Khud baith ke tumhe analyse karna hoga.

  • @shariquekhan8573
    @shariquekhan8573 Před 3 lety

    sir can you share play list for all this problem.

  • @harshyallewar5876
    @harshyallewar5876 Před 2 lety

    Nice sir

    • @Pepcoding
      @Pepcoding  Před 2 lety

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @jivanmainali1742
    @jivanmainali1742 Před 3 lety

    dil khush hogya aapse padh ke

  • @ihowaonaro4511
    @ihowaonaro4511 Před 2 lety

    Is there a way to get this in English ?

  • @kuldeepmeena368
    @kuldeepmeena368 Před 3 lety

    your explanation is too good , but here we can do one more optimization here we can take "transactions(t)=min(n/2 ,t)".then it'll not give runtime error

  • @gauravsingh4355
    @gauravsingh4355 Před 3 lety +2

    Sir ye Foundation aur level 1 same hai? issmein 30 - Q of DP, level up matlab level 2? ussmein 60 - Q of dp tho ye IP kya hai?
    btw thanks for helping students :)

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Beta ip 4th year ke bacho ke liye hian jinpe time nahi bacha. Unko uttha ke leetcode kra dete hain

  • @rkrohitkumarful
    @rkrohitkumarful Před 3 lety

    cant we solve it like -> find all transaction -> sort all transactions in descending -> if transactions

    • @mickyman753
      @mickyman753 Před 2 lety

      overlapping transaction kaise manage kroge isme , galat hoga ye solution

  • @reyazahmed9320
    @reyazahmed9320 Před 3 lety +2

    Can we solve the previous problem where we used 2 transactions, using this approach by putting k=2?

    • @Pepcoding
      @Pepcoding  Před 3 lety +1

      Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.

    • @sainathreddy2632
      @sainathreddy2632 Před 3 lety +1

      yes

  • @mickyman753
    @mickyman753 Před 2 lety

    sir iska inutition kaise aya ,ya ye kisi similar problem ka variation hai kya?

    • @Pepcoding
      @Pepcoding  Před 2 lety

      For clearing all your doubts visit on nados.pepcoding.com
      Also don't forget to follow us on Instagram

  • @amritgupta5703
    @amritgupta5703 Před 4 lety +1

    Wow

  • @ghanendrapanwar165
    @ghanendrapanwar165 Před 2 lety

    sir why cant we buy and sell share at the same day where we are getting max profit

  • @w3java265
    @w3java265 Před 2 lety

    how to identify this problem is Dp problem

    • @Pepcoding
      @Pepcoding  Před 2 lety

      For better insight, visit nados.io, post your doubts, community will help you out there.

  • @anshrohatgi4202
    @anshrohatgi4202 Před 3 lety

    Please anyone help

  • @shubhamsharma335
    @shubhamsharma335 Před 3 lety

    Sir memoization me ye optimization kaise lagegi?

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.

  • @rishabhgoyal8110
    @rishabhgoyal8110 Před 2 lety

    Shouldn't the answer be max of the last column?

    • @Pepcoding
      @Pepcoding  Před 2 lety

      For better experience and precisely arranged videos.
      Visit - nados.pepcoding.com and sign up to NADOS.
      Don't forget to follow us on Instagram instagram.com/pepcoding/

  • @AdarshKumar-mf3ls
    @AdarshKumar-mf3ls Před 3 lety

    sir foundation ka dp pura ho gaya h?
    foundation course pura dal chuka h ya abhi or baki h ?

    • @Pepcoding
      @Pepcoding  Před 3 lety

      han beta, foundation ka dp poora hai. usme 30 he questions hain. ab level2 mei 120 questions aur dalenge - 60 levelup ke, 60 IP ke. total dp questions 150 ho jaenge

  • @Phoenix-xi2gy
    @Phoenix-xi2gy Před 3 lety +1

    Sir agr aap k transaction with fee/cooldown bhi krwadenge to bohot help hojaegi... Maine teeno videos dekhne k baad socha but sahi se logic bn ni paaya... thoda brief me btado ya kisi next video me short me btado

    • @mickyman753
      @mickyman753 Před 2 lety

      agr solution ho iska bhai abhi tk toh share kro ,mai cooldwon+fee kr paa rha hu ,but k transaction with cooldown/fee nhi kr pah rha

  • @RajeshSarkar-ud9oj
    @RajeshSarkar-ud9oj Před 2 lety

    op cntnt

  • @riyabishambu2950
    @riyabishambu2950 Před 3 lety +1

    Sir telegram channel join nahi ho raha

    • @Pepcoding
      @Pepcoding  Před 3 lety

      Beta, dubara try kr k dekho, or you can contact us on 01140194461. Our team will help you with the same.

  • @komalbansal3255
    @komalbansal3255 Před 3 lety +1

    sir this solution is showing memory limit exceed on leetcode.

    • @raghavbansal9020
      @raghavbansal9020 Před 3 lety +2

      It is because when k gets greater than the prices.length/2, then it's equivalent to max profit from infinite transactions. Add that case, MLE will be gone.

    • @komalbansal3255
      @komalbansal3255 Před 3 lety

      What actually is the reason for this?

    • @shubhamsood1406
      @shubhamsood1406 Před 3 lety

      @@raghavbansal9020 I am getting TLE also after adding prices.length/2 condition, I am doing as => apply infinite transaction solution for k > prices.length condition, else do the same as of this video.