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

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

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

  • @ARYANMITTAL
    @ARYANMITTAL  3 หลายเดือนก่อน +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 3 หลายเดือนก่อน

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

    • @zen-g-host
      @zen-g-host 3 หลายเดือนก่อน

      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 3 หลายเดือนก่อน

      please provide with the pdfs especially for long videos

  • @dharmeshkumar3408
    @dharmeshkumar3408 3 หลายเดือนก่อน +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 3 หลายเดือนก่อน +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 3 หลายเดือนก่อน +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 3 หลายเดือนก่อน +2

    Gajab explanation ❤
    Hats off to your hard work and patience

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

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

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

    Yaar maza aa gya. Lovely explanation.

  • @suyashjadaun3279
    @suyashjadaun3279 3 หลายเดือนก่อน +2

    Ho jayega 45K subscribers

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

    @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!

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

    great job !!

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

    Good Explaination.Thanks for the timestamps.

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

    very nice bhaiyya.explanation give me the intuitions.

  • @_u_ya-dw6vx
    @_u_ya-dw6vx 3 หลายเดือนก่อน

    it was so good! thank you bhaiya!

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

    Nice Explanations, Thank you sir !!

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

    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 3 หลายเดือนก่อน

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

  • @Abc-lr4bf
    @Abc-lr4bf 3 หลายเดือนก่อน

    thanks good explanantion aryan

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

    Great content!

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

    thanks

  • @adarshsinghparihar7321
    @adarshsinghparihar7321 3 หลายเดือนก่อน +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

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

    Great optimisation

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

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

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

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

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

    Nice explanation

  • @aniketburman2662
    @aniketburman2662 3 หลายเดือนก่อน +1

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

    • @dustbiny.3968
      @dustbiny.3968 2 หลายเดือนก่อน

      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

  • @rajeshsingh-mv7zn
    @rajeshsingh-mv7zn 3 หลายเดือนก่อน

    You're awesome.

  • @rajrajesh1669
    @rajrajesh1669 2 หลายเดือนก่อน +1

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

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

    Good Stuff, Thanks

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

    Great video bro

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

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

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

    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 3 หลายเดือนก่อน +1

    Bro u said 35 k subs in beginning

  • @2amCoder
    @2amCoder 2 หลายเดือนก่อน +1

    6:20 bro i moved on

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

    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.

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

    the best! thank you

  • @user-xh9uj1tf3l
    @user-xh9uj1tf3l 2 หลายเดือนก่อน

    how java guy can play with bitsets

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

    ❣❣❣❣

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

    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.
    th-cam.com/video/Uz2iNhjGGm0/w-d-xo.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

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

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

  • @rutwikmore7462
    @rutwikmore7462 3 หลายเดือนก่อน +1

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

    • @user-bh9ts7db5r
      @user-bh9ts7db5r 3 หลายเดือนก่อน

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