Single Number II II 4 -Methods II Bit Manipulation II Leetcode 137 II C++/Java/Python

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024

Комментарии • 50

  • @ARYANMITTAL
    @ARYANMITTAL  Год назад +13

    Don't know what Leetcode smoked before placing this question in a Medium Category 🥵!!
    Checkout DSA-169 Series: ruclips.net/video/5BuKVS-Vnws/видео.html
    Problem Link: leetcode.com/problems/single-number-ii/description/
    Code & Notes: drive.google.com/file/d/1-f0XzUitIZ-U0ieKkomuyK_xUhulAttG/view?usp=sharing

  • @gouthamp9066
    @gouthamp9066 Год назад +6

    One of the best best RUclipsr who can explain any hard problem easy thanky Aryan we will remember you for ever because your making our lives better

  • @sherlockjunior8612
    @sherlockjunior8612 Год назад +8

    I guess, at 7:44 you mean to check 3*1e4 for N and not 2^31 because the N is the size of the input, not the range of numbers...

  • @shreyanshthakur5405
    @shreyanshthakur5405 Год назад +3

    After looking Leetcode solutions section and not understanding the intuition behind the bit manipulation approach, I came here and simply got the intuition behind that very easily.
    Thanks a lot for explaining the links and thought process Aryan!!!

  • @raftywate
    @raftywate Год назад +5

    Thank you, Aryan! It's a beautiful video. Helped me improve my thought process. Glad that I came across your channel.

  • @oqant0424
    @oqant0424 Год назад +1

    beautifully explained.......................the only person on the whole internet who teaches how to build the solution❤❤

  • @santoshprasadyadav2198
    @santoshprasadyadav2198 2 месяца назад

    Loved the way you explained bro, best video for this question i found so far!!

  • @jamjam3448
    @jamjam3448 2 месяца назад

    My favorite man. Thanks, man

  • @noobplays6673
    @noobplays6673 Год назад

    class Solution {
    public:
    int singleNumber(vector& nums) {
    int ones=0, twos=0;
    for(int n: nums){
    ones = (ones ^ n) & ~twos; // frequency is 0 and not 2
    twos = (twos ^ n) & ~ones; // frequency is 2 and not 1
    }
    return ones;
    }
    };

  • @nikhilbabar2226
    @nikhilbabar2226 Год назад +2

    Why the solution 3 doesn't work for negative numbers

  • @JihadIsmail
    @JihadIsmail Год назад

    Thank you so much, I have been looking for the last approach explanation specifically for the last 3 days. Your way of explaining the things and your passion are amazing.

  • @shashikiran5385
    @shashikiran5385 2 месяца назад

    you're underrated

  • @aftabrahman5863
    @aftabrahman5863 6 месяцев назад

    great work

  • @worldfromhome4033
    @worldfromhome4033 Год назад

    Nice idea of encapsulating the set bits that have come once and twice and then modifying them🔥

  • @NihalSingh-ld2en
    @NihalSingh-ld2en Год назад +2

    did you tried to submit your 3rd intution code ? as the number can be negative this intution will not work

    • @nikhilbabar2226
      @nikhilbabar2226 Год назад

      Yes, it is not working for negative numbers

    • @jayantsahu6792
      @jayantsahu6792 Год назад

      class Solution {
      public:
      int singleNumber(vector& nums) {
      int n = nums.size(), ans = 0;
      for (int i = 0; i < 32; i++) {
      int sum = 0;
      for (int j = 0; j < n; j++) {
      sum += (nums[j] >> i) & 1;
      }
      sum = sum % 3;
      ans = ans | (sum

  • @bkmeher9005
    @bkmeher9005 6 месяцев назад

    Great bhai

  • @rohanpradhan3160
    @rohanpradhan3160 Год назад +4

    Loved the approach and how you got to it.. Loved it Thanks......

  • @tejuschaturvedi6234
    @tejuschaturvedi6234 Год назад

    Mind blowing explanation 💫. The last approach is so amazing . You are very good at this explanatory work . ❤

  • @midas8003
    @midas8003 Год назад +1

    Loved the approach bro !

  • @rishabhgupta9846
    @rishabhgupta9846 Год назад +1

    Thanks for the video

  • @iWontFakeIt
    @iWontFakeIt Год назад

    Last approach was ❤

  • @pindersingh4924
    @pindersingh4924 Год назад +1

    i start my day with solving leetcode problem of the day , and then during breakfast i watch your solution video , love your videos.

  • @BiswajitDas-lk7pp
    @BiswajitDas-lk7pp 6 месяцев назад

    Best Explanation but sound is not Clear

  • @nadeking1530
    @nadeking1530 Год назад

    You earned a sub ! Kudos to your hard work !!!

  • @kale-lb5pr
    @kale-lb5pr 5 месяцев назад

    how bit manipulation is taking place pls help im doing dr and run im not getting?

  • @AanganwadiGuriya
    @AanganwadiGuriya 11 месяцев назад

    It was nice one !

  • @kale-lb5pr
    @kale-lb5pr 5 месяцев назад

    i have one question like i was doing dry and run on array [5,5,5,6,4,4,4] after when array element first 4 comes if gtes xor with what ones contains so it technically has 6 bcoz it occured ones then when we xor 6^4 it will not remain 6 pls tell me what im doing wrong something is off i cant pinpoint pls help folks!!

  • @kale-lb5pr
    @kale-lb5pr 5 месяцев назад

    array needs to be sorted i guess

  • @arihantjainajbil8182
    @arihantjainajbil8182 Год назад

    approach 4 is lit

  • @saunaknandi1814
    @saunaknandi1814 Год назад

    Aryan can u make complete video dedicated to bit manipulation?

  • @nikeshmali8506
    @nikeshmali8506 Год назад

    thanks.

  • @a.y_u.s_h
    @a.y_u.s_h Год назад

    salute

  • @45_ritiksharma32
    @45_ritiksharma32 Год назад

    Please solve longest palindromic subsequence leetcode -2484

  • @kale-lb5pr
    @kale-lb5pr 5 месяцев назад

    #include
    using namespace std;
    int singleNumII(vector a,int n)
    {
    int ones=0,twos=0;
    int i;
    for(i=0;i

  • @kanishparihar5497
    @kanishparihar5497 Год назад

    class Solution {
    public:
    int singleNumber(vector& nums) {
    int ans = 0;
    for(int i=0;i

    • @GOLUKUMAR-zi9nv
      @GOLUKUMAR-zi9nv Год назад

      It doesn't work for negative numbers

    • @jayantsahu6792
      @jayantsahu6792 Год назад

      class Solution {
      public:
      int singleNumber(vector& nums) {
      int n = nums.size(), ans = 0;
      for (int i = 0; i < 32; i++) {
      int sum = 0;
      for (int j = 0; j < n; j++) {
      sum += (nums[j] >> i) & 1;
      }
      sum = sum % 3;
      ans = ans | (sum

  • @user-no5mo9jv5m
    @user-no5mo9jv5m Год назад

    too much for me ! 😢

  • @harsh8174
    @harsh8174 Год назад

    forrr 22222

  • @tejaspatel2212
    @tejaspatel2212 Год назад +3

    38 min video 🤦🏻‍♂️. Who's gonna waste time.. why can't you make under 20 min video or split the video

    • @peachpink2831
      @peachpink2831 Год назад +12

      why can't you check timestamp and skip to the part u need, you don't need to watch all 4 approaches

    • @kartikeyrana3736
      @kartikeyrana3736 Год назад +1

      same lol, i'm waiting for neetcode to start uploading again, till then will have to make do with him.

    • @noobnessmee
      @noobnessmee Год назад +7

      he can just cut his overactting and video would be 20 mins lol

    • @rohanpradhan3160
      @rohanpradhan3160 Год назад +17

      Why are you saying that? If you don't enjoy it, simply choose not to watch it. You may inadvertently demotivate him from creating more content.

    • @harshal8781
      @harshal8781 Год назад +3

      @@noobnessmee it's very easy to say anything about anyone, you should thanks him for such unique content on YT which no one explains the concept in such depth (and that you also know that's why you are here watching his videos 😛). It's easy to comment on someone, try it on your own you will realise it. And his expressions speaks how much dedicated he his with his work.✌️