DP#2: Coin Change Problem Number of ways to get total | Dynamic Programming | Algorithms

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 พ.ย. 2024

ความคิดเห็น • 380

  • @JennyslecturesCSIT
    @JennyslecturesCSIT  5 ปีที่แล้ว +150

    CORRECTION: @16:20 in coin 5 and weight 6 intersection it should be 2, at coin 5 and weight 11 intersection it should be 4, at coin 10 and weight 6 intersection it should be 2, in coin 10 and weight 11 intersection it should be 4.
    I hope you guys got this correction. :)

    • @ShaliniSingh-xc5rn
      @ShaliniSingh-xc5rn 5 ปีที่แล้ว

      Yes mam

    • @kushagraagarwal3297
      @kushagraagarwal3297 5 ปีที่แล้ว +8

      Code you have written will give a segmentation fault as you are referring to the index of a[i-1] and i is 0; Thanks.

    • @SunilKumar-hu3ow
      @SunilKumar-hu3ow 5 ปีที่แล้ว +2

      Can u post the code if possible as iam unable to write the code for the first row

    • @xavierxavier97
      @xavierxavier97 4 ปีที่แล้ว +1

      Thx for this video, but u have mistake in first for loop. U cannot have j + 1:
      twoDimensional[i][j] = twoDimensional[i-1][j]
      continue
      if j + 1 - coins[i] == 0:
      twoDimensional[i][j] = 1 + twoDimensional[i-1][j]
      continue
      if j + 1 - coins[i] > 0:
      twoDimensional[i][j] = twoDimensional[i-1][j] + twoDimensional[i][j-coins[i]]
      print(twoDimensional)
      coins = [2,3,5,10]
      doMatrix(mince2,15)

    • @swetas6431
      @swetas6431 4 ปีที่แล้ว

      @@xavierxavier97 hi mince 2 means???

  • @ihsandag7405
    @ihsandag7405 2 ปีที่แล้ว +24

    I have never seen a more clear explanation for this popular problem. I'd wish to have all my instructors like you back in time. Now I stand and clap this great instructor. Thanks!!!

    • @umeshreddy6971
      @umeshreddy6971 3 หลายเดือนก่อน

      wohh galat heii BC

  • @alixaprodev
    @alixaprodev 5 ปีที่แล้ว +7

    12:52 when you are saying fine. This is the best style i have ever seen. just enjoying your way of teaching.

  • @MiddleEasternInAmerica
    @MiddleEasternInAmerica 3 ปีที่แล้ว +8

    Thank you so much Jenny, much love and respect for you and all Indians from Egypt

  • @antaratewary9645
    @antaratewary9645 5 ปีที่แล้ว +14

    please make a complete series on dynamic programming.I have scourged the internet,and you are by far the best.Please help students in understanding such concepts.Thank you so much.

    • @JennyslecturesCSIT
      @JennyslecturesCSIT  5 ปีที่แล้ว +8

      Few are covered and working on ..... Pls check my videos and playlist for more

    • @sharanreddy5658
      @sharanreddy5658 3 ปีที่แล้ว

      th-cam.com/play/PL_z_8CaSLPWekqhdCPmFohncHwz8TY2Go.html

  • @adityaprasadsahu1458
    @adityaprasadsahu1458 ปีที่แล้ว

    Hats off to you mam, literally you are far far better teaching from our college professor to whom we are paying lakhs of rupees.
    Bow down for your deliberate teaching and the way you are teaching.
    If this kinda teaching we gonna get we will definitely fall in love with DSA/DAA.

  • @vasugupta4745
    @vasugupta4745 5 ปีที่แล้ว +9

    I think DSA (specifically DP) is the only part in coding where most of IT professionals lack skills to code because most of the teachers aren't able to explain clearly, but through your videos, you can help every young IT professional to understand these concepts better

  • @HeyItsVishal
    @HeyItsVishal 5 ปีที่แล้ว +2

    i wish hamare yaha itni achi teacher hoti you are great

  • @ramziadil8613
    @ramziadil8613 3 ปีที่แล้ว +3

    You are the best! You explained this so clearly! It was so helpful that you explained what the rows, columns, and what each cell represented as well as the strategy for calculating the values. I was so confused when my professor lectured about it, but in so little time, I learned a lot from you! THANKS SO MUCH!!

  • @reshyasudhiv8105
    @reshyasudhiv8105 ปีที่แล้ว

    Super mam..I I'll become a best professor award in my college ..really you I'll helping me a lot.. very much big fan of your work..thank you once again mam..

  • @asifking3714
    @asifking3714 3 ปีที่แล้ว

    Thank you mam and for those who are saying they didn't get this explanation try to concentrate on board more...everything here is crystal clear ❤️❤️

  • @nandhakumarkr3147
    @nandhakumarkr3147 8 หลายเดือนก่อน +1

    Thank you for explaining the great tricking dynamic programming to all. Your explanation made it easy . Kudos great work 🎉

  • @libitard
    @libitard 3 ปีที่แล้ว

    I want to thank you for explaining why Amount 0 is always 1. I have watch other videos and they never explain it the way you do. Thank you very much.

  • @maverickhackers783
    @maverickhackers783 ปีที่แล้ว

    Thank you so much mam ,i watched this video in almost four channels but i wasnt able to get a proper idea about how to proceed but your explanation made it very easy for me to understand

  • @rushabhsinhsolanki5350
    @rushabhsinhsolanki5350 4 ปีที่แล้ว +2

    You and your way of teaching are just Awesome...
    Great Explanation....
    Thanks for it.....👍👍👍👍👍

  • @adityanjsg99
    @adityanjsg99 11 หลายเดือนก่อน

    Explained with enormous patience!

  • @vasugupta4745
    @vasugupta4745 5 ปีที่แล้ว +1

    Wow, wish you would have made them almost one year ago..I would have scored 100/100 in DSA..still thanks ..pls keep making such useful videos..Great method of explaining...❤️ ❤️ ❤️ ❤️

  • @tourwithkausik7730
    @tourwithkausik7730 4 ปีที่แล้ว

    Beauty with Brain. deadly combination....Thank you so much mam, You just save me from my biggest obstacles.....

  • @riteshtadvi544
    @riteshtadvi544 4 ปีที่แล้ว

    Thank you so much madam...
    I missed my ADA lecture
    Then i found your Videos
    Very Useful For Me.

  • @陳寬-x6d
    @陳寬-x6d 2 ปีที่แล้ว +4

    Thank you very much. Your lectures are best and really save my algorithms course at university. Without your lectures, I will probably fail my course. Can you pls make vedios on backtracking algorithms and related problems like N-queens and Sudoku in the future?
    Thank you for your great lectures:)

  • @tufanpondu9511
    @tufanpondu9511 ปีที่แล้ว +1

    Thanks mam Finally i understand the coin change problem.🧑‍💻🧑‍💻

  • @harshitprose7319
    @harshitprose7319 5 ปีที่แล้ว +9

    finally i found a grt vedio with some good explanation .

  • @personalsolutions5658
    @personalsolutions5658 ปีที่แล้ว

    Thank you! Helped me solve Project Euler Nos 76 & 77 in less than 1/10 ms run time!!!👏

  • @bharatkumarshukla3743
    @bharatkumarshukla3743 5 ปีที่แล้ว +11

    Ma'am thank you so much your lecture really helped me understand the algorithm behind this problem. Though I was able to implement the algorithm I still have one doubt as to what was the logic behind including the coin step? Though I was able to implement it but couldn't understand it very well. Thanks.

  • @allamtajusarof5649
    @allamtajusarof5649 2 ปีที่แล้ว +6

    very clear, no hesitation, really understandable. love this lecture... thank you for creating a great videos. 🧡🧡

  • @pallavipriya1145
    @pallavipriya1145 4 ปีที่แล้ว +5

    Your code will give a segmentation fault when i==0 as it is accessing i-1
    Explanation is really nice. Thanks.
    Correct code :
    for(int i=0;i

    • @-VLaharika
      @-VLaharika 2 ปีที่แล้ว

      In else block for i==0 table[i][j]=table[I][j-coin[I] I think

  • @srikarbandla213
    @srikarbandla213 2 หลายเดือนก่อน

    Beauty and Brains, very rare, beautiful explanaition. Had you been my BTech professor, my attendance would be 100%,

  • @chengchen3074
    @chengchen3074 ปีที่แล้ว

    love you ! never meet a teacher such clearly and good!

  • @bajracha
    @bajracha 5 ปีที่แล้ว +5

    Thanks for such a clear explanation and detail walk through of the problem.

  • @singaram1176
    @singaram1176 2 หลายเดือนก่อน

    Your explanation is great mam, but you could also try asking the viewers thought provoking questions like why this particular approach of Include/Exclude approach and explain how to think like this at first which may help them not only to understand the problem but also able to give similar solutions in future with better understanding (Only thing that's seems to be missing in your wonderful videos :) !)\

  • @aniketsinha101
    @aniketsinha101 3 ปีที่แล้ว

    I genuinely loved the approach of tushar roy in the same problem.

    • @aniketsinha101
      @aniketsinha101 3 ปีที่แล้ว

      Theres no meaning to mug up some random method, just because it gives the answer, an explanation behind the method should be given, and not doing some bodmas operation without any logic.

  • @tanaytapanshu9839
    @tanaytapanshu9839 4 ปีที่แล้ว

    The way you algos ma'am is really amazing

  • @rudraduttsisodiya3101
    @rudraduttsisodiya3101 5 ปีที่แล้ว +2

    I already know this, still watched full video. Just because the way you teach it. Thank you. Please keep on uploading make studying interesting.

  • @GianfrancoYosida
    @GianfrancoYosida 2 ปีที่แล้ว +1

    you are amazing, it's enjoyable how you teach these concepts in a so simple way!

  • @pratikkorat790
    @pratikkorat790 4 ปีที่แล้ว

    Really formula looks to scary but you explained it in observation method....salute.. regards from ld college of engineering...😌

  • @Jhjh7724
    @Jhjh7724 3 ปีที่แล้ว +2

    this is super helpful, especially the exclusion and inclusion part, keep up the good work!

  • @TuxHouseEdu
    @TuxHouseEdu 4 ปีที่แล้ว +2

    thank you so much!!!
    Greetings from Greece.

  • @ayo_emmanuel
    @ayo_emmanuel 3 ปีที่แล้ว +1

    You're the best Jenny, THANK YOU!

  •  ปีที่แล้ว +1

    So happy mam thank You soooooo much 🙌🏻🙏🏻 God Bless You ☺️

  • @risabhkedia2685
    @risabhkedia2685 3 ปีที่แล้ว

    I write very few comments on youtube. But really your work is commendable. Jai ho Jenny didi ki 😁😁

  • @MirSuhailMohammad
    @MirSuhailMohammad 3 ปีที่แล้ว +1

    Beautifully explained. Appreciate your Work Ma'am.

  • @soumyadiptabanerjee8256
    @soumyadiptabanerjee8256 4 ปีที่แล้ว

    Mam your way of teaching dp is great..Plz make more videos..

  • @XxKingfisherxX
    @XxKingfisherxX ปีที่แล้ว

    Thanks Jenny! This is the best video i've seen on this topic!

  • @graham12345dd
    @graham12345dd 2 ปีที่แล้ว

    You're a very good lecturer
    Bravo and thanks! I'm off home now to code this in c++. THANK YOU!!

  • @jiganeshpatil1472
    @jiganeshpatil1472 4 ปีที่แล้ว

    Best tutorial channel ever

  • @quochung1268
    @quochung1268 2 หลายเดือนก่อน

    you really save my semester 😍😍😍😍

  • @upsax7576
    @upsax7576 4 หลายเดือนก่อน

    This woman is extremely clever that is all I can say.

  • @vivekdhage8296
    @vivekdhage8296 5 ปีที่แล้ว +1

    Solved......from you.....this.....is...lit🔥🔥🔥thanks for helping us

  • @sarahbavan3959
    @sarahbavan3959 4 หลายเดือนก่อน

    Thank you Jenny! lots of love

  • @mahamatdjibrine95
    @mahamatdjibrine95 2 ปีที่แล้ว +1

    Thank you Mam , Please keep it up . You are really great 🙏

  • @dmitrykurkin427
    @dmitrykurkin427 4 ปีที่แล้ว +1

    I would add a bit of tech background on the 3 items (exclude|include|add). Thanks anyways for the explanation

  • @thehecticprogrammer1
    @thehecticprogrammer1 11 หลายเดือนก่อน +1

    The table format of 2, 3 ,5 10 is wrong in middle, please solve it on your own but her method is correct.it takes our 30 minutes to identify this error. Thanks

  • @flaironov
    @flaironov 3 ปีที่แล้ว +1

    Ma'am, thankyou for clearing concepts💛

  • @deepakprajapati5064
    @deepakprajapati5064 4 ปีที่แล้ว

    your explanation is just awesome , cleared my all doubts related to this topic.
    and one more thing you have a beautiful dipper eyes

  • @retrogame3138
    @retrogame3138 5 ปีที่แล้ว +3

    You doing great job please make a video on how should crack the interview of product based company

  • @alphaman3765
    @alphaman3765 3 ปีที่แล้ว +1

    wonderful explanation.Pls do include such videos

  • @MM-ib6qh
    @MM-ib6qh 3 ปีที่แล้ว +1

    Wow, you are an amazing teacher. Thank you!

  • @mitpatel8348
    @mitpatel8348 5 ปีที่แล้ว +1

    I see many videos but in this video I learn making change at the first time thanks lot

  • @Algo-gr7xz
    @Algo-gr7xz 4 ปีที่แล้ว

    Thanks a lot madam.Your explanation is very good and helpful for us

  • @maheshvangala8472
    @maheshvangala8472 5 ปีที่แล้ว +6

    Please make more videos on algorithms especially dynamic programming
    Good explanation thanks a lot

  • @ankushyamkar3602
    @ankushyamkar3602 4 ปีที่แล้ว +1

    Thank you mam❤️ for such kind of explanation ,but my question is how did u get the logic behind this problem

  • @srujanwankhede5314
    @srujanwankhede5314 4 ปีที่แล้ว +1

    TYSM mam it was very helpful of you to explain so deep. Please keep explaining such algorithmic questions.

    • @srujanwankhede5314
      @srujanwankhede5314 4 ปีที่แล้ว

      also in the first for loop their should be ( i < len(coins) )

  • @gothams1195
    @gothams1195 4 ปีที่แล้ว

    You are god , very detailed explanation. Could not understand the implementation part when my professor at university teaches.Thank you very much

  • @thesuperiorman8342
    @thesuperiorman8342 4 ปีที่แล้ว +1

    Thank you for this step by step guide. I was struggling to understand how to formulate the table but I think I grasped it now.

  • @eshikasaxena6936
    @eshikasaxena6936 3 ปีที่แล้ว

    Very easy explanation.

  • @myroncarvalho4872
    @myroncarvalho4872 5 ปีที่แล้ว +7

    at 16:18 for coin 5 and weight 6 there are 2+0 possible ways to get 6. it's written 3? even logically 2+2+2 and 3+3 are the two possible ways no third way to get 6 using coins of 2,3 and 5.

    • @JennyslecturesCSIT
      @JennyslecturesCSIT  5 ปีที่แล้ว +5

      Yes it would be 2...by mistake I wrote 3.. Just follow the formula and u will get 2..btw thanks for this correction

    • @myroncarvalho4872
      @myroncarvalho4872 5 ปีที่แล้ว +1

      @@JennyslecturesCSIT yes I was solving along so stumbled on that difference. Thanks for the videos. Helped a lot!

  • @HelloBangladesh389
    @HelloBangladesh389 ปีที่แล้ว

    Thanks a lot Apu............ It's great for understanding

  • @Damarnadh13
    @Damarnadh13 4 ปีที่แล้ว

    Thank you ... Your explanation helped me alot for understanding of logic clearly..

  • @anuragdwivedi1804
    @anuragdwivedi1804 5 ปีที่แล้ว +2

    mam you are the best !!!! very very gud method of teaching keep uploading more and more vedeos

  • @vivekpaliwal1876
    @vivekpaliwal1876 5 ปีที่แล้ว +2

    Good Explanation...main logic is clear but how to the make first row in program? that 1,0,1,0,1,0 kind of.

  • @anonymous-cb2bi
    @anonymous-cb2bi 3 ปีที่แล้ว

    Thank you for the simple explanation really appreciate that

  • @jimwoodward7293
    @jimwoodward7293 4 ปีที่แล้ว +1

    Very nicely explained -- thank you.

  • @sketchbookofdeve
    @sketchbookofdeve 19 วันที่ผ่านมา

    Mam you are a game changer :)

  • @thrilleracaste400
    @thrilleracaste400 ปีที่แล้ว

    Thank you ma'am. Wonderfully explained!

  • @3x10.8_ms
    @3x10.8_ms ปีที่แล้ว

    ATM is the good example which uses this algorithm

  • @Sasikumar-kr7xy
    @Sasikumar-kr7xy 4 ปีที่แล้ว

    Expecting more videos related to dynamic programming or coding related problems.

  • @borat_trades2860
    @borat_trades2860 4 ปีที่แล้ว

    best all covering tutorial

  • @abhishekjaiswal6492
    @abhishekjaiswal6492 3 ปีที่แล้ว

    Great explanation mam, you did clear everything..

  • @vakul121
    @vakul121 4 ปีที่แล้ว +13

    you should also explain how did you get this approach,rather than just showing the pattern in the table!!

    • @ashgr8eng
      @ashgr8eng 4 ปีที่แล้ว

      For an explanation of why refer to her video where she talks about the 'why?' th-cam.com/video/J2eoCvk59Rc/w-d-xo.html

  • @saikoushik3812
    @saikoushik3812 5 ปีที่แล้ว +3

    Extraordinary explanation mam. Thanks
    How to compute values for a[0][j] when i=0 iteration programatically?

  • @amlansahoo07
    @amlansahoo07 4 ปีที่แล้ว +1

    Great explanation ma'am. A suggestion, your video can be better if you start with providing the intuition to the solution :)

  • @varaprasadkurra6361
    @varaprasadkurra6361 3 ปีที่แล้ว

    Perfect Explanation of Backtracking. Thank you

  • @vishukohli1109
    @vishukohli1109 5 ปีที่แล้ว +1

    Very good explanation

  • @heomappro1
    @heomappro1 2 ปีที่แล้ว

    Great explanation! Thanks a lot Jenny.

  • @mb77mb66
    @mb77mb66 2 ปีที่แล้ว

    "simple rule" :D You need to explain why, with examples. Had to watch another video to understand what you were saying.

  • @raheelshaikh1057
    @raheelshaikh1057 4 ปีที่แล้ว

    using 1D array
    def coinchange(s,m,n):
    arr = [0 for x in range(n+1)]
    arr[0] = 1
    for i in range(m):
    for j in range(s[i],n+1):
    arr[j] += arr[j-s[i]]
    return arr[n]
    def main():
    s =list(map(int,input('Enter the coin array:').strip().split()))
    m = len(s)
    n = int(input('Enter the main amount:'))
    result = coinchange(s, m, n)
    print(result)
    if __name__=='__main__':
    main()

  • @amanwarudkar9913
    @amanwarudkar9913 5 ปีที่แล้ว +1

    Nice and in depth explanation maam and if possible then please make a video on 'Top down and Bottom up approach' 👍👍

    • @Finn-jp6pn
      @Finn-jp6pn 5 ปีที่แล้ว

      She already has one. Here you go:
      th-cam.com/video/lVR2u9lsxl8/w-d-xo.html

    • @amanwarudkar9913
      @amanwarudkar9913 5 ปีที่แล้ว

      @@Finn-jp6pn Thanks 🙂

  • @laraibanwar1618
    @laraibanwar1618 3 ปีที่แล้ว +1

    if u want to understand dp check aditya verma's dp series
    thats the best series u will ever watch on dp

  • @ManishGupta-xi5kd
    @ManishGupta-xi5kd 4 ปีที่แล้ว

    thank you ,
    you way teaching is awesome .i like it

  • @shivamkotnala155
    @shivamkotnala155 3 ปีที่แล้ว

    Thanks you so much ma'am, solid explanation,plz add more video in this playlist ma'am.

  • @taschajalani7927
    @taschajalani7927 4 ปีที่แล้ว +1

    Thank you so much! You really helps me in preparing for my test! 👍🏻

  • @sudhirpratapsingh5730
    @sudhirpratapsingh5730 5 ปีที่แล้ว +1

    Superb explanation , Thanks a lot .

  • @thiagoleobons390
    @thiagoleobons390 4 ปีที่แล้ว +1

    10:00 "the shortcut if coin value > sum then just copy the above value this is the simple trick, this is the simple rule".. this is where I get lost.. the rest of the video seems to heavily rely on this "trick" but I just cant deduce where this comes from. I see some other comments in the video from people that also seem to not be able to follow from this part. Some replies mentioned another video of yours and even other people but I still dont get where the formula comes from

    • @vivekprasad5221
      @vivekprasad5221 3 ปีที่แล้ว

      Correct !!!...Even i also got stuck in same place. @Jenny :- You should 1st explain the logic behind this problem..That how to deduce the formula instead of just writting the code using formulas.

  • @anmolchaurasia9401
    @anmolchaurasia9401 4 หลายเดือนก่อน

    Ma'am! You're great

  • @rahulchaubey8988
    @rahulchaubey8988 4 ปีที่แล้ว

    Very good explaination.. Thanks

  • @nknidhi321
    @nknidhi321 3 ปีที่แล้ว

    Ma'am you are super awesome.. Thank you for the content..❤️🙏

  • @owaisch3442
    @owaisch3442 3 ปีที่แล้ว

    Really nice explanation

  • @ivandrofly
    @ivandrofly 3 ปีที่แล้ว +1

    I think there is a mistake in row 3 column 6. It should have been 2 not 3.... We take the value above 2+tablet[2, (6-5)]

  • @utkarshsrivastava9236
    @utkarshsrivastava9236 5 ปีที่แล้ว

    Please make on some advance DP problem also you are awesome...loved the way you explain

  • @RiyaSingh-mq1vb
    @RiyaSingh-mq1vb ปีที่แล้ว

    Thank you for the explanation!!