Frog Jump | Khandaani Tareeka | Memoization | GOOGLE | AMAZON | META | Leetcode-403

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ม.ค. 2025

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

  • @saisanthosh8694
    @saisanthosh8694 ปีที่แล้ว +22

    I've seen a ton of your videos over past few weeks and they are GOLD. Keep up the great work man! 👏
    Honestly wish that your channel has more reach!

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

      Hi Santhosh.
      Your generosity and kind words mean the world to me ❤️❤️❤️
      I will try my best to work even more hard to post more quality contents.
      Thank you 😇❤️🙏

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

      Hi @saisanthosh8694 I am not aware how you did that (

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

      True. The best I have found yet online.

    • @mycollegeLife.
      @mycollegeLife. 5 หลายเดือนก่อน

      @@wearevacationuncoverers super thanks button aside to download button

  • @wearevacationuncoverers
    @wearevacationuncoverers ปีที่แล้ว +12

    I have never seen anyone doing a dry run this clean and sharing literally EVERY MINUTE DETAIL.
    I want to salute you for your consistency, dedication and patience ❤

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

    Problem mast tha, itana hard nahi tha. Lekin question samajna usko solve karne se zyada hard tha. Isiliye mene aapka video dekha question samaj ne ke liye aur khud hi code kiya solution dekhe bina aur accept bhi ho gaya, aapke lectures bot helpful ho rahe he, me literally meri past-self se zyada achha perform kar raha hu. Thank you!!!!!

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

    Kya gajab ka explanation dete hain sir aap👏 unique solution and way of teaching.

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

    iPad PDF Notes - github.com/MAZHARMIK/Interview_DS_Algo/blob/master/iPad%20PDF%20Notes/Leetcode-403-Frog%20Jump.pdf
    **************************************** JAVA ****************************************
    //Approach-1 (Recursion + Memo) - T.C : O(N^2)
    class Solution {
    HashMap mp = new HashMap();
    int t[][] = new int[2001][2001];
    int n;
    boolean solve(int[] stones, int curr_stone_index, int prevJump) {
    if(curr_stone_index == n-1)
    return true;
    boolean result = false;
    if(t[curr_stone_index][prevJump] != -1)
    return t[curr_stone_index][prevJump] == 1;
    for(int nextJump = prevJump-1; nextJump 0) {
    int next_stone = stones[curr_stone_index] + nextJump;
    if(mp.containsKey(next_stone)) {
    result = result || solve(stones, mp.get(next_stone), nextJump);
    }
    }
    }
    t[curr_stone_index][prevJump] = (result ? 1 :0);
    return result;
    }
    public boolean canCross(int[] stones) {
    n = stones.length;
    if(stones[1] != 1)
    return false;
    for (int i = 0 ; i < stones.length; i++) {
    mp.put(stones[i], i);
    }
    //Mark all states as -1 to denote they're not calculated.
    for (int i = 0; i < 2000; i++) {
    Arrays.fill(t[i], -1);
    }
    return solve(stones, 0, 0);
    }
    }

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

    month starts with Recurrsion and ending with recurrsion also. In between the time period i have learned a lot of things from u. So thanku for everything sir.

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

      Always a pleasure to see such comments 😇❤️🙏

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

    You are just mesmerizing. Itna patiently koi kaise parha sakta ha. hats off to you

  • @AlishaKhan-ww3io
    @AlishaKhan-ww3io ปีที่แล้ว +1

    I always wait for your video. This is the best explanation I found so far since morning.

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

    It's only because of you I am able to solve such ins on my own. Thank you LEGEND

  • @gui-codes
    @gui-codes 9 หลายเดือนก่อน

    "Khandani Tareeka" - Never heard this before by literally anyone 😅 But it's unique.
    Hats off to your unique style of teaching

  • @Tejaswi-xd4re
    @Tejaswi-xd4re ปีที่แล้ว +5

    @codestorywithMIK sir even though I don't know much about dsa, as I just completed 12; I still watch ur videos for ur better reach...
    Many people regret that they found ur channel late..
    But even before my first semester starts, I feel very lucky that I found ur channel. Sir...

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

      Same. I feel so lucky to have found this channel

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

      It means a lot. Thank you so much 😃❤

    • @Tejaswi-xd4re
      @Tejaswi-xd4re ปีที่แล้ว

      @@codestorywithMIK still waiting sir kab aayega video

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

      Travelling back to home. Video will come tonight

    • @Tejaswi-xd4re
      @Tejaswi-xd4re ปีที่แล้ว +1

      @@codestorywithMIK ok sir

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

    full video OP hai bhai

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

    I have done this question by my Own Thanks Bhaiya Again For Great Explanation

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

    I saw two more videos before watching this video and unable to understood problem. but your explanation made it easy.

  • @iamnoob7593
    @iamnoob7593 5 หลายเดือนก่อน +1

    Out of the world explanation

  • @k.vabhavmishra
    @k.vabhavmishra ปีที่แล้ว +1

    This videos shows why Dryrun is most important until then problem seems difficult .Thankyou sir

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

    this is the first hard question I was able to do by myself I just needed the explanation of the question. the test cases were not soo helpful initially. Watching your previous 50+ DP videos surely helped :)

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

      class Solution {
      public:
      unordered_map mp;
      int n;
      int t[2001][2010];
      bool solve(vector& stones, int idx, int k){
      if(idx>=n){
      return false;
      }
      if(idx==n-1){
      return true;
      }
      if(t[idx][k]!=-1){
      return t[idx][k];
      }
      bool subOne = false;
      if(k-1!=0 && mp.find(stones[idx]+k-1)!=mp.end()){
      subOne = solve(stones, mp[stones[idx]+k-1], k-1);
      }
      bool same = false;
      if(mp.find(stones[idx]+k)!=mp.end()){
      same = solve(stones, mp[stones[idx]+k], k);
      }
      bool addOne = false;
      if(mp.find(stones[idx]+k+1)!=mp.end()){
      addOne = solve(stones, mp[stones[idx]+k+1], k+1);
      }
      return t[idx][k] = subOne || (same || addOne);
      }
      bool canCross(vector& stones) {
      n=stones.size();
      memset(t, -1, sizeof(t));
      for(int i = 0; i

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

      I am the happiest person when i see such comments.
      I am so glad you solved it on your own. ❤️❤️

  • @mycollegeLife.
    @mycollegeLife. 5 หลายเดือนก่อน +1

    Awesome bro! really top noch content

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

    Finally did it by myself. Debug karte karte pura din nikal gaya. but last tak kar diya. ab chain ki nind le sakta hu😁😁

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

      So glad 😇❤️
      Keep up the hard work. Time will come when you and all of us will be able to solve problems in minutes ❤️❤️

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

    You have explained it so damn clear and precise... Nice work man, subscribed

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

    Excellent Solution mik bhai. I was close with the recursion part aka our khandani tareeka but was not able to figure the map intuition. love you bhai ❤❤❤❤🚀🚀🚀🚀

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

      Always welcome ❤️😇
      Love and respect to all of you guys 😇

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

    Thanks Sir 🙏

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

    Simply THE Best

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

    This question was way too easy because of your DP concepts playlist I was able to solve this on my own.🤝
    One request please make similar concepts playlist for other topics also. It will be really helpful😍

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

    Awesome 👍

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

    ❤❤waited

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

    Superb 🎉

  • @prathammishra7844
    @prathammishra7844 20 วันที่ผ่านมา +1

    Got it boss❤

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

    Great Explanation mik bhai❤❤❤❤

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

    Bhaiya can you please explain solutions of contests problems also because your explanation is superb

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

    Sahi baat h, medium hona chaiye tha, kyunki khud se solve hogya 😆

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

    one word i can say thanks :)🥰🥰🥰🥰🥰🥰🥰🥰

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

    ❤❤❤❤❤

  • @AmarjeetKumar-to9ub
    @AmarjeetKumar-to9ub ปีที่แล้ว +2

    Thank You :)

  • @09avishkargaikwad71
    @09avishkargaikwad71 ปีที่แล้ว

    I have made this question by own but still watching videos.
    One request from community : Sir can u please start to make the videos on weekly and biweekly leetcode contest solution ??

  • @tanvisharma4123
    @tanvisharma4123 5 หลายเดือนก่อน

    Hey,
    Have you posted the bottom up approach as well?

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

    11:38 that hits hard🤐

  • @Tejaswi-xd4re
    @Tejaswi-xd4re ปีที่แล้ว +2

    Sir when will guidance video come

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

    Class solution {
    Public boolean canCross (vector >mpp;
    mpp[stones [0]+1]={1};
    for(int i=1;i

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

    sir i solve 400+ question consisently and i cant solve new problem or i cannot understand the problem .so what i should do please suggest me?

    • @k.vabhavmishra
      @k.vabhavmishra ปีที่แล้ว +1

      bhai Dryrun Krke kr Approach clear rahega code
      ho jayega .Solution ke peeche mat bhago just concepts strong karo .

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

      Hi there,
      I will cover these qns in my next Guidance Video Part-II
      (Noted)

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

      @@codestorywithMIK okk bhai

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

      @@k.vabhavmishra okk

  • @hm-ue2ol
    @hm-ue2ol ปีที่แล้ว

    how you figure out that prevjump will go from 0-2001 in memorization as it can be 2^31 also na

  • @Gaurav-vl6ym
    @Gaurav-vl6ym 10 หลายเดือนก่อน

    why we take dp size 2001X2001 , since jumps can go upto 2^31-1

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

    bro can you take this problem next
    Maximum Number of Non-overlapping Palindrome Substrings-2472
    I was able to solve this problem but with time limit 2400 ms and beats just 5%
    I want to know your approach , and this problem is also very nice
    Thank you problem

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

    thanks++ ;

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

    bhai kaise pta chala ki "k" ki max value stones.length jitni hi hogi?

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

      first time k 1 hoga fir max k+1 hum usse bna skte ek baari mai so it will be 1 then 1+1=2, then 3 then 4 then max till stones length cuz k+1 hum utni baar hi krenge jitne stones ho skte hai

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

      @@YashSinghal got it, thanks brother 🥰

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

      Correct @Yash.
      Thank you 😇❤️

  • @AnmolGupta-oj4lm
    @AnmolGupta-oj4lm 7 หลายเดือนก่อน

    class Solution {
    public:
    int n;
    unordered_map mpp;
    int dp[2001][2001];
    bool canCross(vector& nums) {
    n = nums.size();
    for(int i=0; i

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

    bhaiya aaj ka conest mai kitna question bna aapka?

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

      Hey Nikhil,
      I usually am not able to give contests because i travel during weekends mostly to give myself some rest.
      Also due to travelling my Sunday POTD videos are delayed (posted after noon)
      However i will solve them for sure when I am back home.

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

      @@codestorywithMIK oh ok got it loved your explanation bhaiya😌

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

      @@codestorywithMIK Wow! Where did you go? I love traveling too!

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

      @@nikhilkumartiwari7973 Thank you so much 😃❤

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

      Hey @@aadil4236 , Currently Jaipur.
      And next month I will be going out of India for few months for traveling and some work as well. However, I will be posting videos for sure ❤.

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

    class solution {
    Public boolean canCross(int []stones){
    int n=stones. length ();
    boolean [][]dp=new boolean [n][n+1];
    dp[0][1]=true;
    for(int i=1;i

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

    Brother as a student what should I learn along with dsa

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

      Since the competition is increasing, I would suggest you to get good hands on dev side things as well or you can get basics of System Design as well. It will help a lot in future.
      You can choose the topic but it is always a good option to be good in multiple things + DSA.

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

    Did not understand the line
    result = result || solve()

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

      result = result || solve()
      We call solve for 3 different possibilities.
      If anyone of the possibility returns True, we want the result to be true.
      So, taking or ‘||’ helps to achieve that.