3201, 3202. Find the Maximum Length of Valid Subsequence II | | Math | DP | LIS Similar

Поділитися
Вставка
  • Опубліковано 27 сер 2024

КОМЕНТАРІ • 35

  • @justarandomguy6106
    @justarandomguy6106 Місяць тому +6

    i also tried the recursive memoize approach TC-> O(k^2 *n) and i got MLE.

  • @atheisth2373
    @atheisth2373 Місяць тому +4

    not understood

  • @umangbehl8152
    @umangbehl8152 Місяць тому +1

    this is a complex explanation usually if a tutor explains in a complex way i dry run by myself to understand what he is saying but in this video i have to rewatch some of the section again and again to understand

  • @princenagar1686
    @princenagar1686 Місяць тому +13

    Aryan Mittal read it positively please => you are under misconception that you are simplifying problem, but you are actually overexplaining everything which is actually harder to understand than it actually should.
    My suggestion => Try to focus on what i said and try to see that in your videos. You can explain to only those actually don't need explanations, that's where comes tricky part that if someone already know intution then he will think that you are explaining very good, and if he doesn't know approach then he will think that he himself need to improve because of your over justifying things, rather you should just simplify problem to everyone like it force them to think that actually problem was too easy, that's where youtubers like Striver, Love babbar, CodeWithHarry , chai aur code , etc, shines and you do not even come close to them.

  • @SurbhiGoyal-v4h
    @SurbhiGoyal-v4h Місяць тому +1

    This solution is incredible! good work!

  • @jade-zc2bz
    @jade-zc2bz Місяць тому +8

    i cant understand 🥲

  • @cameye9
    @cameye9 Місяць тому +5

    What I was thinking in first at the time of contest is using recursive with memoization and it is good to go and solved both Q2 & Q3 but when I used memoization it gives memory limit exceed error i both the cases and My submission is left with just last 10 cases in both the Questions and due to that I was stuck on these Questions in my whole leetcode contest and that actually ruined/fucked up my mind totally. My question is that to you Aryan that how we should think out like these approaches at the time of contest because in my mind apart from memoization no other approached come .

    • @sanketchugh294
      @sanketchugh294 Місяць тому

      He is been doing this for many years now. It's all about consistent practice and evolving yourself with different approaches

    • @cameye9
      @cameye9 Місяць тому

      @@sanketchugh294 Thank you I didn't know this before.

  • @princenagar1686
    @princenagar1686 Місяць тому +3

    12:08 don't explain code we are not machines, explain approach with dry runs, and please take it positively and you will shine on youtube in the world of coding.

  • @ajayprabhu465
    @ajayprabhu465 Місяць тому +1

    aryan cant understand this, idk why, first the first time feeling very bad

  • @rafeeqm
    @rafeeqm Місяць тому

    great video Aryan

  • @Ayush37262
    @Ayush37262 Місяць тому +2

    Bhai 1st wali bhi thodi tricky thi

  • @udaymourya7322
    @udaymourya7322 Місяць тому +1

    My memoization java code runs ->
    class Solution {
    int dp[][];
    int kk;
    public int maximumLength(int[] nums, int k) {
    int n = nums.length;
    kk = k;
    dp = new int[n+1][k+1];
    for (int[] d1 : dp) {
    Arrays.fill(d1, -1);

    }
    int ans = 0;
    for(int i=n-1; i>0; i--){
    for(int j=i-1; j>-1; j--){
    ans = Math.max(ans , 2 + solve(nums , j , (nums[j] + nums[i]) % kk)); //finding first two elements.
    }
    }
    return ans;
    }
    public int solve(int[] nums, int pre, int mod) {
    if (pre == -1) return 0;
    if (dp[pre][mod] != -1) return dp[pre][mod];
    int ans = 0;
    for (int i = pre-1; i >= 0; i--) {
    if ((nums[i] + nums[pre]) % kk == mod) {
    ans = Math.max(ans, 1 + solve(nums, i, mod));
    break;
    }
    }
    dp[pre][mod] = ans;
    return ans;
    }
    }

  • @yashwairagade3677
    @yashwairagade3677 Місяць тому +1

    suggestion if possible remove top down section as it is so much confusing rest other is awesome

    • @rafeeqm
      @rafeeqm Місяць тому +1

      completely disagree, it's for the intuition

  • @HindiDubbedReels
    @HindiDubbedReels Місяць тому +1

    Bhai hindi me bol liya kro nhi dekhra koi bahr ka tume vo discussion section se samajh kete ha

  • @Robinkumar-ew9ky
    @Robinkumar-ew9ky Місяць тому +1

    Today's problem to upload karo jaldi
    Remove Graph edges

    • @Jazzimus
      @Jazzimus Місяць тому +2

      check their community post

    • @Robinkumar-ew9ky
      @Robinkumar-ew9ky Місяць тому +3

      @@Jazzimus
      I checked it already in morning but unfortunately I thought it is only hint so I didn't click on it and I couldn't see the video link.
      Thanks .

  • @hritikanand9734
    @hritikanand9734 Місяць тому +3

    🫡

  • @soumyapadhy3414
    @soumyapadhy3414 Місяць тому +3

    First why r u elaborating all the stuffs which is very much irritating secondly u r teaching to graduate student not a kg school child

    • @rafeeqm
      @rafeeqm Місяць тому +1

      Not everyone watching is a graduate student

    • @khushal7363
      @khushal7363 Місяць тому +1

      dude if see his hard problem explanation he make them look damn easy by this style and skip the simple part i usually do that and watch at 1.5-1.75.

  • @Shashank-e3x
    @Shashank-e3x Місяць тому

    Bro please accept my connection request !!

  • @yashwairagade3677
    @yashwairagade3677 Місяць тому

    optimization of 3202 freezed my brain

  • @Shashank-e3x
    @Shashank-e3x Місяць тому

    Bro please accept my connection request !!

    • @ARYANMITTAL
      @ARYANMITTAL  Місяць тому

      Bro full name to bata dete🥲, how will i search just Shashank ❤️