Minimize XOR | 2 Detailed Approaches | Dry Runs | Leetcode 2429 | codestorywithMIK

Поділитися
Вставка
  • Опубліковано 28 січ 2025

КОМЕНТАРІ • 78

  • @codestorywithMIK
    @codestorywithMIK  14 днів тому +20

    Video is lengthy ? Use timelines below ❤️
    ✨ Timelines✨
    00:00 - Introduction
    00:28 - Motivation
    02:04 - Problem Explanation
    05:29 - Approach-1 Thought Process
    16:55 - How to set a bit position ?
    18:54 - How to unset a bit position ?
    21:52 - How to check if a bit position is set ?
    25:13 - Coding Approach-1 in C++
    31:43 - Coding Approach-1 in JAVA
    35:51 - Approach-2 Thought Process
    45:56 - Coding Approach-2 in C++
    50:10 - Coding Approach-2 in JAVA

  • @Shattered2715
    @Shattered2715 14 днів тому +23

    aj socha tha k apke video k baad he makarsankranti hogi or finally aa gaya video❤❤

  • @manibhushankumarsingh5196
    @manibhushankumarsingh5196 14 днів тому +17

    First quote is from Bhagvad Gita, it is the teaching of shree krishna to Arjuna!!!❤

  • @rahulsihara8946
    @rahulsihara8946 14 днів тому +13

    Mik these motivation quotes are lowkey empowering. Helps a lot in keep going. thanks for everything mate.
    You are the best.

    • @codestorywithMIK
      @codestorywithMIK  14 днів тому +1

      Means a lot ❤

    • @imPriyansh77
      @imPriyansh77 14 днів тому +1

      @@codestorywithMIK Yes MIK. Never stop these motivational quotes at the beginning of your every video...

  • @leenamondal4946
    @leenamondal4946 14 днів тому +15

    I am able to solve today's question by myself. I am realising that slowly I am growing. In this month, I have able to solve most of the POTD's on my own.Few months back, while I was seeing such questions, I had started to watch videos immediately. But now, I first try to solve the question .Then come to watch your video for new approach.Thank you MIK bhaiya❤.

  • @AmdinCire-iq4jq
    @AmdinCire-iq4jq 14 днів тому +18

    Congrats for 80k 🔥

  • @gui-codes
    @gui-codes 14 днів тому +7

    Congrats for 80k 🔥 LEGEND.
    No wonder you are the most hardworking UA-cam I see. Others posting 10-15 minute videos, and here this Legend posted a postmortem of the approaches. A big thank you from a BEGINNER ❤❤❤

  • @RandomGuy34-j1u
    @RandomGuy34-j1u 14 днів тому +6

    Bit manipulation itne ache se kabhi nhi samjha tha thank you so much 🙏🙏

  • @Ankitkumar-fz3kc
    @Ankitkumar-fz3kc 14 днів тому +4

    I have solved this question my own but come here to learn something as you drop 52 min banger and indeed I learnt it.

  • @Resham298
    @Resham298 14 днів тому +5

    many many congrats on 80K #mik
    Allah apki sare dua kubul kare ❤

  • @vaidehi4002
    @vaidehi4002 14 днів тому +5

    quote for tomorrow : To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment.🌼

  • @sauravchandra10
    @sauravchandra10 14 днів тому +1

    This was definitely easy for someone who has solved questions of bit manipulation.
    Python implementation of the second approach:
    class Solution:
    def minimizeXor(self, num1: int, num2: int) -> int:
    bitsNum1, bitsNum2 = bin(num1).count("1"), bin(num2).count("1")
    if bitsNum1 == bitsNum2:
    return num1
    elif bitsNum1 > bitsNum2:
    num = 0
    for i in reversed(range(32)):
    if bitsNum2 == 0:
    return num
    if (num1>>i)&1 == 1:
    num |= (1i)&1 == 1:
    num |= (1

  • @EB-ot8uu
    @EB-ot8uu 14 днів тому +1

    other youtubers don't teach everything so that they can then ask us to join their courses.
    Here MIK posts everything even for a simple problem so that we can understand a problem from every aspect. Hats off to you MIK and congratulations on 80k subs. You will soon reach Millions

  • @aws_handles
    @aws_handles 14 днів тому +2

    You are a LEGEND.
    Congrats on 80K Subs. Soon 100K and then 1M soon

  • @aizad786iqbal
    @aizad786iqbal 14 днів тому +2

    video timeline mai aapka code approach mai "C" like ke aata hai instead of C++
    congrats on 80k
    InshaAllah 100k will happen soon..

  • @yereneager
    @yereneager 14 днів тому +1

    I tried out possibilities on paper, and was able to think of approach 2 directly still I came to learn more things. Thanks for all the time you have put in this gem content.

  • @Devendar7
    @Devendar7 14 днів тому +1

    bro you are best bhagwaan apki aur apke family ki har wish puri kare😇ekdin aapse jarur milunga

  • @dyashwanth9822
    @dyashwanth9822 14 днів тому +2

    Thanks bhai, i watched till 9:35 got some intuition then build my logic to solve the problem .❤❤

  • @adityazende6710
    @adityazende6710 14 днів тому +1

    first 24:31 is the best for beginners who want to learn bit manipulation

  • @joydeep-halder
    @joydeep-halder 14 днів тому +1

    Thank you so much bhaiya. ❤❤ Aj ka question mast tha.

  • @Kai-z8j7v
    @Kai-z8j7v 14 днів тому +3

    Hello MIK please start solving contest problems
    If anyone else feels the same like this 🎉

  • @abhinavgarg0077
    @abhinavgarg0077 14 днів тому +1

    amazingly explained.

  • @gitansh194
    @gitansh194 14 днів тому +2

    Trust me guys this 52 minutes will be worth it. you will learn lots of thing. So go for it.

  • @bhuppidhamii
    @bhuppidhamii 14 днів тому +1

    Best Quote I've ever heard ❤

  • @italk-gj5kk
    @italk-gj5kk 14 днів тому +1

    Thanks for the solution

  • @challengeAceiver
    @challengeAceiver 14 днів тому +1

    Hii bhaiya mein ne aapka first approach hi socha lekin thoda complicated code likha hai mein ne
    class Solution {
    public:
    int minimizeXor(int num1, int num2) {
    int ones= 0;
    int temp= num2;
    //calculating the number of 1 bits present in num2
    while(temp!= 0){
    if((temp & 1)== 1) ones++;
    temp>>= 1;
    }
    temp= num1;
    string n1bits;
    //Creating a string of num1
    while(temp!= 0){
    n1bits.push_back((temp&1)+'0');
    temp>>= 1;
    }
    int n= n1bits.size();
    //checking if the ones are equal to number of one present in the n1bits, end to start
    for(int i= n-1; i>= 0; i--){
    if(ones

  • @devlpr-nitish
    @devlpr-nitish 14 днів тому +1

    congratulations on 80k

  • @monikagarg5139
    @monikagarg5139 14 днів тому +1

    Thank you so much for the awesome explanation and helpful solution videos! 🙌
    I’m pretty new to coding, and even though I understand the logic, but I struggle a lot when it comes to writing or implementing the code. I’ve only learned a few DSA topics so far, so I’m not sure how to handle this.
    Should I try solving POTD along with learning DSA concepts, or should I focus on covering the DSA topics first? Would really appreciate your advice.
    Thanks!

    • @codestorywithMIK
      @codestorywithMIK  14 днів тому +1

      Thank you so much for your kind words. I'm glad the videos are helping.
      Since you're new to coding, I suggest focusing on building a strong foundation in DSA concepts first. Learn one topic at a time and practice a few problems related to it to gain confidence in implementation.
      Once you're comfortable with the basics, you can start solving POTD (Problem of the Day) as it will help you apply your knowledge and improve problem-solving skills gradually.
      Remember, consistency is key! Take it step by step, and don't hesitate to revisit concepts if needed. You've got this! 💪

  • @adii16089
    @adii16089 14 днів тому +3

    Sir I solved it by myself..no hints..O(n)(actually O(2n)):)

  • @sahebraojadhav9727
    @sahebraojadhav9727 14 днів тому +1

    The great geeta motivation.chaptere 2 verse 48

  • @misskiller6120
    @misskiller6120 14 днів тому +2

    Success is not the result of spontaneous combustion. You must set yourself on fire with purpose, passion, and persistence.

  • @mrnibba4565
    @mrnibba4565 14 днів тому +4

    my anxiety📈 with the cooker ki seeti at 14:05

  • @sahebraojadhav9727
    @sahebraojadhav9727 14 днів тому +1

    Thank u note for mik❤❤❤

  • @vivekchaurasia3055
    @vivekchaurasia3055 13 днів тому +1

    Hello MIK,
    I purchased your membership and just wanted to know if there are any members-only videos on this channel to which the members will have access. Ya phir sare videos normal subscriber ke liye bhi visible honge.
    Love your content tho!

    • @codestorywithMIK
      @codestorywithMIK  13 днів тому +2

      Dear Vivek,
      I want to mention that the membership feature was given by UA-cam after crossing some threshold subscribers count. I usually don’t want any paid service, so the amount for membership should be default value given by UA-cam only.
      There is no difference in the contents that I provide in membership and non-membership as of now.
      So if you wish, you can definitely opt-out of the membership .
      Hope you understand 😇❤️🙏
      And thank you for your kind words ❤️

    • @vivekchaurasia3055
      @vivekchaurasia3055 13 днів тому +1

      @codestorywithMIK Thank you for being honest.

  • @nikhilaggarwal9325
    @nikhilaggarwal9325 14 днів тому

    adding java with c++ is a good move

  • @kusumjoshi4613
    @kusumjoshi4613 14 днів тому +1

    Waiting for 100k mik😍

  • @somyakumar5919
    @somyakumar5919 14 днів тому +1

    because of you I became consistent on leetcode.
    thanks a lot mik.

  • @Tbm4545
    @Tbm4545 13 днів тому +2

    22:19

  • @priyajaiwal8072
    @priyajaiwal8072 14 днів тому +1

    Here is your trophy for doing post-mortem of sawaals like no one else.

  • @aryansinha1818
    @aryansinha1818 13 днів тому +1

    See lil code : 46:00

  • @sukanshigarg6051
    @sukanshigarg6051 14 днів тому +1

    wow

  • @siddharthpatil-oc6oo
    @siddharthpatil-oc6oo 14 днів тому

    In the second approach, the new function to check whether bit is unset is redundant. We could just use isSet that we wrote for the first approach.

  • @shaundabre5552
    @shaundabre5552 14 днів тому +1

    Tommarow's motivation : Accept what you cant change, change what you cant accept. When you start to see your potential, the grind becomes personal

  • @parthbhatti4151
    @parthbhatti4151 14 днів тому +2

    for only detail explaination i used to prefer your video

  • @team-fanfeet
    @team-fanfeet 13 днів тому +1

    Present sir

  • @krishna-kaushall
    @krishna-kaushall 14 днів тому

    In case of unset a bit What if we simply xor rather than taking negative and then ANd

  • @AYUSHGUPTA-j2i
    @AYUSHGUPTA-j2i 14 днів тому +1

    I solved it on my own but it took me 40min

  • @sainathpatil2674
    @sainathpatil2674 14 днів тому +1

    Bahiya prefix sum pe playlist bana do😢

  • @VardaHanwant
    @VardaHanwant 14 днів тому +1

    i find it difficult to identify edge cases and time complexity. Please any way to improve in this areas.

  • @harshsharmaeducational9857
    @harshsharmaeducational9857 12 днів тому

    sir question ke ipads ke solution upload kar digiye

  • @Rohit_Hitman_Sharma_4545
    @Rohit_Hitman_Sharma_4545 14 днів тому +2

    Short Motivation for tomorrow: “A quitter never wins and a winner never quits.”

  • @bhuppidhamii
    @bhuppidhamii 14 днів тому +1

    I fear from Bit Manipulation Q's.
    What to do,

  • @dibbodas4116
    @dibbodas4116 14 днів тому

    I scared when i see bit manipulation questions and unable to solve what to do mikbhai?? ❤❤

  • @e_sumit
    @e_sumit 14 днів тому +2

    dekhunga to aapki video hi dekhunga nhi to q hi ni kru😹😹

  • @prathamdhiman7071
    @prathamdhiman7071 12 днів тому

    (3418. Maximum Amount of Money Robot Can Earn) hey please help me to understand this question`s sol. Please

  • @somyakumar5919
    @somyakumar5919 14 днів тому +1

    आपका अधिकार ही नहीं कर्म के फल (results) पे,
    जब अधिकार ही नहीं, तो फल तो आपका है ही नहीं,
    जिस पे अधिकार है नहीं, वो आपकी हो कैसे सकती?
    अधिकार केवल कर्म करने का है।
    तो जिस चीज़ पर अधिकार है, उसे सही से करने का चिंतन कीजिए।

  • @leenamondal4946
    @leenamondal4946 14 днів тому +3

    I am able to solve today's question by myself. I am realising that slowly I am growing. In this month, I have able to solve most of the POTD's on my own.Few months back, while I was seeing such questions, I had started to watch videos immediately. But now, I first try to solve the question .Then come to watch your video for new approach.Thank you MIK bhaiya❤.