3181 & 3180 | BitSet Crash Course | DP | 3181. Maximum Total Reward Using Operations II & I

Sdílet
Vložit
  • čas přidán 28. 08. 2024

Komentáře • 46

  • @ARYANMITTAL
    @ARYANMITTAL  Před 2 měsíci +21

    I know the video is wayy beyond 20mins(promised time), but pls try to jump on respective Timestamps for understanding 🥺
    .
    And haan iss baar 45k paar ❤

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

      I think in First DP approach the ans should be divide by 2 before returning.

    • @zen-g-host
      @zen-g-host Před 2 měsíci

      Hi Aryan! Amazing explanation indeed. Would it be possible for you to share the PDFs of your explanation you used in the video. It would be really great to glance over after watching the video. Thanks.

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

      please provide with the pdfs especially for long videos

  • @dharmeshkumar3408
    @dharmeshkumar3408 Před 2 měsíci +5

    Thanks brother ! I spent whole day trying to figure out the logic of Hard problem... but after watching this everything is clear.... video was long but necessary.

  • @fraserdab
    @fraserdab Před 2 měsíci +4

    Honestly was so lost when I saw bitset solutions because I've never heard of bitset, watching the video helped a lot

  • @ManishKumar-dk8hl
    @ManishKumar-dk8hl Před 2 měsíci +5

    isse solve krte hue aaj pehle recursion m TLE a gya tha then memoization pe MLE then tabulation krte krte mene haar maan li thi

  • @pabitrakb5291
    @pabitrakb5291 Před 2 měsíci +2

    Gajab explanation ❤
    Hats off to your hard work and patience

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

    One of the finest explanation I've seen . Bhaiya bhot maza ayaa

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

    Yaar maza aa gya. Lovely explanation.

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

    Good Explaination.Thanks for the timestamps.

  • @suyashjadaun3279
    @suyashjadaun3279 Před 2 měsíci +2

    Ho jayega 45K subscribers

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

    very nice bhaiyya.explanation give me the intuitions.

  • @_u_ya-dw6vx
    @_u_ya-dw6vx Před 2 měsíci

    it was so good! thank you bhaiya!

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

    Nice Explanations, Thank you sir !!

  • @sivamanivallabhani2229
    @sivamanivallabhani2229 Před měsícem

    great job !!

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

    @Aryan
    I wanted to share some feedback on your video. I noticed that there were a few instances where the same sentence was repeated multiple times. I believe the video could be even more engaging and concise without those repetitions.
    Just a suggestion for future videos to keep the content as clear and streamlined as possible.
    Thank you for your hard work!

  • @Abc-lr4bf
    @Abc-lr4bf Před 2 měsíci

    thanks good explanantion aryan

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

    thanks

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

    Great optimisation

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

    Great content!

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

    waiting for this video !!!!!!!!

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

    Nice explanation

  • @rajeshsingh-mv7zn
    @rajeshsingh-mv7zn Před 2 měsíci

    You're awesome.

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

    Good Stuff, Thanks

  • @23cash86
    @23cash86 Před 2 měsíci

    Great video bro

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

    in java bitset class cannot be used with "bitwise and" operator. also the inbuilt "and" function stores the result of "and" to the first operand and returns void. Also there is no way to left shift except shifting each set bit left in a loop.

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

      Getting TLE with bitset. #justJAVAthings
      They should just rename it as class ShitSet at this point.

  • @aniketburman2662
    @aniketburman2662 Před 2 měsíci +1

    Why taking a vector dp(n+1) giving tle? can anyone explain?

    • @dustbiny.3968
      @dustbiny.3968 Před měsícem

      i also did same like you,
      the tle is due to search operation in map which takes O(logn) extra to find the sum when compared to vector

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

    How can u take the reward sum value atlast will be the max of rewvalues in the above sum, before 9 mins

  • @adarshsinghparihar7321
    @adarshsinghparihar7321 Před 2 měsíci +1

    DP se nahi kar sakte kya ye problem i am trying to do with dp. 1st one is done by recursive dp
    int n;
    int solve(int i,int x,vector& v,vector& dp){
    if(i==n) return x;
    if(dp[i][x]!=-1) return dp[i][x];
    int nottake = solve(i+1,x,v,dp);
    int take = 0;
    if(x= 0 && x - v[i - 1] < v[i - 1]) {
    take = v[i - 1] + pre[x];
    }
    cur[x] = max(take, nottake);
    }
    pre = cur;
    }
    return pre[0];
    }
    it is showing wrong answer how to correct this please help me to solve this prolblem

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

    Any prerequisities for this video Except BIT MANIPULATION cause I have no knowledge on DP !! ?

  • @rajrajesh1669
    @rajrajesh1669 Před 2 měsíci +1

    22:26 can anyone please give me the mathematical reasoning behind reducing the 10^5 (10^4+10^4), to 10^4 ?

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

    Long videos are needed, the problem is with ppls attention span, which is reduced to less than that of a goldfish due to scrolling reels.

  • @top_g755
    @top_g755 Před 2 měsíci +1

    Bro u said 35 k subs in beginning

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

    the best! thank you

  • @2amCoder
    @2amCoder Před 2 měsíci +1

    6:20 bro i moved on

  • @user-xh9uj1tf3l
    @user-xh9uj1tf3l Před měsícem

    how java guy can play with bitsets

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

    ❣❣❣❣

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

    bhai koi aur color ki t shirt plz.
    Much love :)

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

    You are always my last option to understand a problem, not because you are bad at teaching, rather it means no it's time that I need my best weapon against that question.

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

    i was trying to do dp with binary search, because we require next Element to be greater than the previous one,
    i tried to do like this, jaise aapne ISS VIDEO mein bataya tha,
    bhaiya aap bata sakte ho ki iss question mein ye solution work kyo nahi kar raha.
    czcams.com/video/Uz2iNhjGGm0/video.htmlsi=Tg7B_P-OXmPaHGDT
    (edit) :
    int maxTotalReward(vector& nums) {
    // Remove duplicates and sort the nums vector
    sort(nums.begin(), nums.end());
    nums.erase(unique(nums.begin(), nums.end()), nums.end());
    int n = nums.size();
    // Define the solve function with memoization
    function solve = [&](int t) -> int {
    if (t == 0) {
    return 0;
    }
    auto p = lower_bound(nums.begin(), nums.end(), t);
    if (p == nums.end()) {
    --p;
    }
    if (*p == t) {
    return t;
    } else if (*p > t) {
    if (p != nums.begin()) {
    --p;
    } else {
    return 0;
    }
    }
    int ans = 0;
    while (p >= nums.begin() && *p * 2 - 1 > ans) {
    ans = max(*p + solve(min(t - *p, *p - 1)), ans);
    if (p == nums.begin()) {
    break;
    }
    --p;
    }
    return ans;
    };
    return solve(nums.back() * 2 - 1);
    }
    i found this binary search solution but not able to understand it, can anyone please tell why the call is from (nums.back() * 2 - 1); and not (nums.back() - 1); simply

  • @rutwikmore7462
    @rutwikmore7462 Před 2 měsíci +1

    samjh nhi ata, question itna hard hai ya, ye banda hard bana ke samjhata hai ..😂

    • @user-bh9ts7db5r
      @user-bh9ts7db5r Před 2 měsíci

      Mujhe pata hai tumhe kyu nahi samajh aa raha, aisa isliye ho raha kyuki shayad tum hi gadhe ho