Bitwise AND of Numbers Range | 2 Approaches | Dry Run | Leetcode 201

Sdílet
Vložit
  • čas přidán 28. 07. 2024
  • Whatsapp Community Link : www.whatsapp.com/channel/0029...
    This is the 11th Video of our Playlist "Bit-Manipulation : Popular Interview Problems".
    We will be solving "Bitwise AND of Numbers Range | Leetcode 201" using two approaches.
    Problem Name : Bitwise AND of Numbers Range | Leetcode 201
    Company Tags : GOOGLE
    My solutions on Github : github.com/MAZHARMIK/Intervie...
    Leetcode Link : leetcode.com/problems/bitwise...
    Approach Summary :
    Approach-1 (Using Shift):
    Time Complexity (T.C): O(log(n)), where n is the maximum number of bits needed to represent the given input integers left and right.
    Space Complexity (S.C): O(1)
    Summary: This approach iteratively right-shifts both left and right until they become equal, counting the number of shifts. The result is obtained by left-shifting left by the count of shifts.
    Approach-2 (Using AND Property):
    Time Complexity (T.C): O(log(n)), where n is the maximum number of bits needed to represent the given input integers left and right.
    Space Complexity (S.C): O(1)
    Summary: This approach iteratively applies the bitwise AND operation on right and (right - 1) until right becomes less than or equal to left. The result is the value of right after the loop.
    Both approaches aim to find the bitwise AND of a range of integers (left to right), with the first approach using a shift-based method and the second approach utilizing the property that bitwise AND between a number and its predecessor resets the rightmost set bit.
    My Recursion Concepts Playlist : • Introduction | Recursi...
    My DP Concepts Playlist : • Roadmap for DP | How t...
    My Graph Concepts Playlist : • Graph Concepts & Qns -...
    My GitHub Repo for interview preparation : github.com/MAZHARMIK/Intervie...
    Subscribe to my channel : / @codestorywithmik
    Instagram : / codestorywithmik
    Facebook : / 100090524295846
    Twitter : / cswithmik
    ╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
    ║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
    ╠╗║╚╝║║╠╗║╚╣║║║║║═╣
    ╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
    Timelines : ⏰
    00:00 - Introduction
    00:51 - Problem Explanation
    03:17 - Approach-1 Intuition
    16:52 - Coding Approach-1 + Time & Space Complexity
    20:12 - Approach-2 Intuition
    33:33 - Coding Approach-2 + Time & Space Complexity
    #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #2024 #newyear

Komentáře • 71

  • @codestorywithMIK
    @codestorywithMIK  Před 5 měsíci +36

    Hi guys,
    I have not been well since yesterday evening. High fever and throat issue.
    Hence the video was delayed.
    I hope it helps.
    Thank you all for your love and support.❣❣❣

  • @manimanohar_001
    @manimanohar_001 Před 5 měsíci +14

    Bahiya bit manipulation pe bhi ek playlist bana do like recursion. 1 video per week is enough. 🙏🙏🙏🙏

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

    Bhai pehli 7-8 min me hi samaj me aa gaya solution kya mast batate ho aap! mene khud hi solve karliya pura video dekehe bina. bot simple solution tha! Thank you!

  • @amitchoraria5737
    @amitchoraria5737 Před 5 měsíci +4

    Very well explained :) One of the better videos than all the other videos I have seen on this question. Thanks

  • @aadil4236
    @aadil4236 Před 5 měsíci +3

    Take care of yourself brother the season is changing I was also sick a while ago. And Thank you for the explanation as always!.

  • @anuppatankar4294
    @anuppatankar4294 Před 5 měsíci +1

    2nd approach was awesome 👍🏻

  • @souravjoshi2293
    @souravjoshi2293 Před 5 měsíci

    I was waiting for you only. Thanks a lot

  • @muhammadalikhanbaloch7475
    @muhammadalikhanbaloch7475 Před 5 měsíci +1

    Thank you sir 😊

  • @arjunprasad1071
    @arjunprasad1071 Před 5 měsíci

    Thanks for your explaination!! I tried explaining the first approach to myself by looking at other solutions but was unable to. Was waiting since since morning for your explainer. Wishing you a speedy recovery ;)

  • @wearevacationuncoverers
    @wearevacationuncoverers Před 5 měsíci

    Hats off to your dedication. and take care get well soon.

  • @umeshbisht1054
    @umeshbisht1054 Před 5 měsíci

    Thanku bhaiya ❤

  • @adityaparab4314
    @adityaparab4314 Před 5 měsíci

    The way you are being consistent even after being sick gives me so much inspiration to be disciplined and keep going. Thank you.

  • @Thriftinghai
    @Thriftinghai Před 5 měsíci

    finallyy 🥳. thanks a lot

  • @jeehub041
    @jeehub041 Před 5 měsíci +1

    Nicely explained bhai❤

  • @tutuimam3381
    @tutuimam3381 Před 5 měsíci +1

    Thanks ❤❤❤❤

  • @uvs_6032
    @uvs_6032 Před 5 měsíci +1

    2nd solution is quite nice but i dont think i will ever come up with that in an interview 😅

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

    Thanks, waiting for bits series

  • @ankitsahu2305
    @ankitsahu2305 Před 5 měsíci

    Best explanation, Keep it up❤

  • @JoyAcharyatvl
    @JoyAcharyatvl Před 5 měsíci

    Hore krishna. bhai you are just amazing. nice explanation. learned many things from this video.

  • @oqant0424
    @oqant0424 Před 5 měsíci

    I bow to u for teaching us new things every single day
    U are biggest inspiration to become a great coder ✨✨
    Thanks from the bottom of my 💓💓
    POTD DONE [21.2.24]✅✅

  • @sauravchandra10
    @sauravchandra10 Před 5 měsíci

    Get well soon ❤

  • @non-csesoftwaredeveloper4801
    @non-csesoftwaredeveloper4801 Před 5 měsíci +1

    Waiting for your video bro

  • @gauravbanerjee2898
    @gauravbanerjee2898 Před 5 měsíci

    Thanks a lot bhaiya ❤❤ Hats of to your dedication making videos even when you are not well 🫡Get well soon 🙌

  • @viditvaish7317
    @viditvaish7317 Před 5 měsíci

    as usual sir you are amazing and your explanation is fabulous you never ever disappoint us

  • @EB-ot8uu
    @EB-ot8uu Před 5 měsíci

    Why is always that my doubts are literally always cleared when I see your explanation. 😅

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

    in first approach time complexity is o(1) beacause maximum bit in a integer is 32 any number we shift 32 times it becomes zero

  • @coderletscode
    @coderletscode Před 5 měsíci

    Get well soon!

  • @Ankitkumar-fz3kc
    @Ankitkumar-fz3kc Před 5 měsíci +1

    Thanks again for making this easy through your explanation ❤❤

  • @EatCodeAndSleep
    @EatCodeAndSleep Před 5 měsíci +1

    in first approach we r actually right shifting 32 bits at worst case right then tc will be o(32) only right we can call it as O(1) only instead

  • @sapnokasahar3098
    @sapnokasahar3098 Před 5 měsíci

    I have tried from side.
    Then, I was waiting for your video for better understanding

  • @saketyadav1119
    @saketyadav1119 Před 5 měsíci +1

    hahaha i was waiting for this video from you, tho i already watched aryan mittal's video but i really like how you explain stuff so here again

    • @wearevacationuncoverers
      @wearevacationuncoverers Před 5 měsíci

      Same. I watched Neetcode, Techdose and Aryan's video. couldn't completely get my doubts cleared. Then I always come to this channel and like always I could get the intuition during half of the video and coded it . Something is unique about him.

  • @user-dz5qp1uz4x
    @user-dz5qp1uz4x Před 5 měsíci

    Bhaiyaaa please bit manipulation ki playlist bana dijiya like recursion
    your playlist is is verry useful

  • @codeandtalk6
    @codeandtalk6 Před 5 měsíci

    ❤❤❤

  • @Shivanai_h
    @Shivanai_h Před 5 měsíci

    Thanks, Mik for your hard work, please bring BIT Manipulation Playlist first

  • @faizanalam8823
    @faizanalam8823 Před 5 měsíci

    please share questions of similar pattern!!

  • @newglobal2056
    @newglobal2056 Před 5 měsíci +1

    Bhaiya pehle app lld Lao please and upp jaldi thik ho jao❤❤

  • @theOmKumar
    @theOmKumar Před 5 měsíci

    LCP approach 👌

  • @Strawcontamination
    @Strawcontamination Před 5 měsíci

    Please include backtracking and trees concepts and questions

  • @bhuppidhamii
    @bhuppidhamii Před 5 měsíci

    we want Bit Manipulation Playlist!!!

  • @piyushmaurya8082
    @piyushmaurya8082 Před 5 měsíci +1

    Bhaiya aap kon si company me ho ?

  • @bhuppidhamii
    @bhuppidhamii Před 5 měsíci

    What is the TC of approach 2?

  • @RajChauhan-iu3dc
    @RajChauhan-iu3dc Před 5 měsíci

    Bro can you tell me the name of application on which you use to explain the problems??

  • @swarnadeepsaha4455
    @swarnadeepsaha4455 Před 5 měsíci

    Yes mik thanks a lot for system design , lld, oops

  • @amansaurabh4552
    @amansaurabh4552 Před 5 měsíci

    bhaiya please make video on 289 Game of Life and 1499 Max Value of equation

  • @sauravfarkade7032
    @sauravfarkade7032 Před 5 měsíci +1

    cout

  • @ru45098
    @ru45098 Před 5 měsíci

    In your dp series ,the climbing stairs and first house robber one is showing only of 6 second..please fix the issue

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

      Check the description of those 6 second videos. It contains the link to the full video in a different playlist. I completed few days ago.

    • @ru45098
      @ru45098 Před 5 měsíci

      thanks@@ugcwithaddi

  • @naikajsevak6090
    @naikajsevak6090 Před 5 měsíci

    did u solved this problem first time ??

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 Před 5 měsíci

    Recursion best use by your guidance.
    class Tree{
    public void serialize (Node root,ArrayListA){
    if(root==null){
    A.add(-1);
    return;
    }
    A.add(root.data);
    serialize(root.left,A);
    serialize(root.right,A);
    }
    public Node deSerialize(ArrayListA){
    if(A.size()==0) return null;
    int a=A.remove(0);
    if(a==-1) return null;
    Node root=new Node(a);
    root.left =deSerialize(A);
    root.right=deSerialize(A);
    return root;
    }
    }
    🎉❤