Coding Interview Problem - Decode Ways

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

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

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

    Single person on TH-cam who explained why we are using i-1 + i-2 rest of all are just telling the solution

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

    idk how companies expect me to do this shit is under 30 min. Thank you though.... I've been trying to understand this all day and this is the video that made it click

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

    insane explanation. i can you tell you truly understand the problem and is not just a regurgitation of a working LC solution found online... thanks!

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

    FINALLY get it. Only video where it clicked. Deserves way more likes.

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

      True I concur

  • @pinakeekaushik7803
    @pinakeekaushik7803 4 ปีที่แล้ว +7

    Man please dont stop making these videos, the intution you give to solve the problem is amazing. Upload frequently and your channel will grow soon.

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

      Thank you! Busy with something right now but will definitely keep uploading in a couple months.

  • @velakuruday
    @velakuruday 6 หลายเดือนก่อน +1

    Thank you brother. Only you explained why the i-1 + i-2 is valid.

  • @Martinnnnnn-e5s
    @Martinnnnnn-e5s 13 วันที่ผ่านมา

    After watching like 5 videos about this question finally there's one that i understand. amazing explantion

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

    God level explanation.

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

    This video and explanation is incredible. Why are there not more views??

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

    I think but I could not understand. After watching your lucid video, I understand without thinking, thank you for your diffusive wisdom.

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

    Thanks! Your channel certainly deserves way more attention! - So true - Good work mate...

  • @AlvaroGarcia-fb6oh
    @AlvaroGarcia-fb6oh 10 หลายเดือนก่อน

    First video that helped me understand the tabulation solution! Thanks a lot man.

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

    Really thanks a lot, i have watched so many vudeos in youtube but didn't understand, but finally you given good explainatiin for this question❤️🙏

  • @MinhNguyen-lz1pg
    @MinhNguyen-lz1pg 2 ปีที่แล้ว +1

    Awesome explanation, this should be LC Premium. I feel I got scam paying LC premium when reading the LC solution. Great job!

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

    Finally I understood the solution, tried many videos but this one is best;

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

    Man, what an explanation. you are AMAZING! Thank you

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

    this video is kickass!!

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

    Very clear explanation!

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

    Best explanation I've found, thank you so much

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

    Amazing explanation that will be forever useful. Thank you

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

    thank you! i finally understood the dp subproblems

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

    Thank you so much for this amazing video!!! I really appreciate 🙏 It does really help me understand this problem clearly. Please do more videos like this!

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

    how is dp[0] = 1?

  • @AbhishekSingh-tz3uv
    @AbhishekSingh-tz3uv ปีที่แล้ว

    I have watched a number of tutorials for this one, understood your approach only. Though wrote my implementation of it and it seems a bit different.

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 8 หลายเดือนก่อน

    so good, thank you :)

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

    Amazingly explained

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

    Great video!!! Could you please recommend some books or study material ?

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

    Amazing explanation ! Thank you :)

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

    Great Channel. Keep Going !

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

    wow this was such a good explanation, thank you

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

    Good explanation ! Keep it up

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

    Thank you so much! finally got it!

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

    I’m 95% there. But I’m stuck with this case: 1201. I am thinking only 1 valid decode could be made of this correct? Like 1 | 20 | 1
    But I am having hard time understand how the code deals with this

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

      Case 1: take one digit --> 1
      Case 2: take two digits --> 12
      In case 2, the next digit will be a 0 which is invalid so this does not count.
      In case 1, you move along to 2 and repeat as below:
      Case 1: take one digit --> 2
      Case 2: take two digits --> 20
      In case 1, the next digit is a 0 which is invalid so this does not count.
      In case 2, you move along to 1 and repeat as below:
      Case 1: take one digit --> 1
      Case 2: take two digits --> reached end of string
      You must take case 1. The next index will be out of bounds and you are done.
      Your DP array will look like [1 1 1 1 1], i.e. you can only take one path to get to the end, no addition occurs (or in recursive terms you get a linear path where each possible alternative path leads to a dead end i.e. a leaf)

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

    excellent

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

    thanks for the great video!

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

    Thanks!

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

    finally bless u mann!!!!

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

    how do i get the O(1) space complexity solution?

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

      if you just keep dpi-1 and dpi-2 in two variables, don't need the rest beyond those

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

    thanks for your clean explainations. though this solution does not work for input = "2611055971756562"

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

      yup although its quite an easy fix:-
      let num10to19Range = previousNum == 1 && currentNum

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

    what if i-1==0 ex 12160012 what happens

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

      The answer for this particular case should be 0.