3133. Minimum Array End | Bit Interweaving | Bit Interleaving | Bit Manipulation | 2 Pointers

Поділитися
Вставка
  • Опубліковано 26 кві 2024
  • In this video, I'll talk about how to solve Leetcode 3133. Minimum Array End | Bit Interweaving | Bit Interleaving | Bit Manipulation | 2 Pointers
    Let's Connect:
    📱Discord (Join Community) : / discord
    📝Linkedin: / aryan-mittal-0077
    📸 Instagram: / ez.pz.dsa
    💻 Twitter - / aryan_mittal007
    🤖 Github: github.com/aryan-0077
    About Me:
    I am Aryan Mittal - A Software Engineer in Goldman Sachs, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
    ✨ Hashtags ✨
    #programming #Interviews #leetcode #faang #maang #datastructures #algorithms

КОМЕНТАРІ • 31

  • @user-hv7yx3ps5z
    @user-hv7yx3ps5z 2 місяці тому +2

    The way you explain ideas is like watching a Bollywood movie; it's very engaging.

  • @Noob_Coder1234
    @Noob_Coder1234 2 місяці тому +8

    best youtuber for leetcode , clean explainations with most optimzied codes !! god bless u bro!!

  • @divyanshagrawal6267
    @divyanshagrawal6267 2 місяці тому +4

    Cool Solution Dude :)

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

    best video on entire earth

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

    so well explained

  • @slayer8792
    @slayer8792 2 місяці тому +1

    This is a great solution , very nicely explained

  • @rajan-u6b
    @rajan-u6b 11 днів тому

    love u sir, nice explanation.

  • @aafighters4535
    @aafighters4535 2 місяці тому +1

    Keep going bro.

  • @rishavsaha5254
    @rishavsaha5254 2 місяці тому +2

    Thank you so much for the video.
    There can be a easy solution for this as well:
    Increasing the unset bits:
    long long minEnd(int n, int x)
    {
    long long a = x;
    n--;
    while(n--)
    {
    a=(a+1)|x;
    }
    return a;
    }

  • @bhushanasutkar6135
    @bhushanasutkar6135 2 місяці тому

    Thanks

  • @prathamsharma4416
    @prathamsharma4416 2 місяці тому

    nice 1

  • @hrishavraj7706
    @hrishavraj7706 2 місяці тому

    👌

  • @lavanyam3224
    @lavanyam3224 2 місяці тому

    Awesome explanation bro!! Can you pls solve 3134 also?

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

    nBit[i] should be equal to ((n-1)>>1)&1 na instead of (n>>1)&1 as You have taught the same thing at 12:39

  • @dhruvrawatt9
    @dhruvrawatt9 2 місяці тому +2

    I give up on coding

  • @AdityaYadav-qf9qc
    @AdityaYadav-qf9qc 2 місяці тому

    @aryanmittal can we apply binary search on answer on this question??

  • @242deepak
    @242deepak 2 місяці тому

    Easiest code:
    class Solution {
    public:
    long long minEnd(int n, int x) {
    long long ans=x;
    long long k=n-1;
    for(int i=0;i

  • @ias5462
    @ias5462 2 місяці тому

    I understood the logic..but i didn't get the intuition why n-1 number only we have to do the 2 pointer thing..like is there any concept behind

  • @psk9736
    @psk9736 2 місяці тому +5

    When setting xbit[i] and nbit[i] I used
    xbit[i] = x & (1 i) & 1
    (n >> i) & 1

    • @ARYANMITTAL
      @ARYANMITTAL  2 місяці тому +5

      Let us say you want to know existence of 2nd bit i.e for a number 4, which has binary representation as 100, then your code will say xbit[2] = 4 while, you wanted to know just that if that 2nd bit was set or not, which means you wanted xbit[2] = 1, xbit will have only 2 values 0 or 1, saying if some bit was set or not

    • @psk9736
      @psk9736 2 місяці тому

      ​@@ARYANMITTALoh accha 😅😅 understood thankyou ❤❤

    • @danishsaifdtu9203
      @danishsaifdtu9203 2 місяці тому

      @@ARYANMITTAL int se & krne pr int me convert ho jata hai no?
      or 1 se krne pr binary me rehta hai?

    • @ayushtandon1719
      @ayushtandon1719 2 місяці тому

      You can also do this
      xbit[i]=x&1;
      x>>=1;
      nbit[i]=n&1;
      n>>=1;

  • @mrityunjoybarman9098
    @mrityunjoybarman9098 2 місяці тому

    Why my code is giving me wrong ans for 56 testcases ?
    public long minEnd(int n, int x) {
    int j = 0;
    long ans = (long)x;
    for(int i=0; i> i) & 1);
    if(bit == 1) continue;
    if((1 n-1) break;
    int newBit = (((n-1) >> j) & 1);
    j++;
    if(newBit == 0) continue;
    ans |= (newBit

  • @RitikRanjan-fn9me
    @RitikRanjan-fn9me 2 місяці тому +1

    Intuition ban gya tha , but implement ni hua :/

  • @pranjalverma8239
    @pranjalverma8239 2 місяці тому

    bhai kuch samaj nhi aaya 😢