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

In this video, I'll talk about how to solve Leetcode 137. Single Number II II Bit Manipulation II Pattern Recognition
Checkout DSA-169 Series: • Aryan DSA-169 Series |...
Problem Link: leetcode.com/problems/single-...
Code & Notes: drive.google.com/file/d/1-f0X...
Let's Connect:
📝Linkedin: / aryan-mittal-0077
📸 Instagram: / aryan_mittal_007
📱Telegram : t.me/aryan_mittal_group
🤖 Github: github.com/aryan-0077
🛍️ Products I use in Videos: (✨ Marked for Mostly requested Products)
Main Camera (Canon 200D ii): amzn.to/41cfS5h
Vlog Camera (iphone 13): amzn.to/42aOJRh
Tripod for Lectures: amzn.to/3HMoloF
Tripod for Vlogs: amzn.to/44wGL6L
✨Mic: amzn.to/41bj8gU
Shadow Multi Colour Light: amzn.to/41bmIrq
Main Light: amzn.to/3LF6BNb
Tripod for Lights: amzn.to/3LFcQAt
Softbox for Lights: amzn.to/42mHqWE
✨My Pen Tablet for Notes: amzn.to/44A61ZJ
✨New Tablet for Notes: amzn.to/44BjTDa
Tablet Stand: amzn.to/3NMFIJR
Power Bank: amzn.to/421yHsZ
✨USB Hub: amzn.to/3p8NGTf
✨HardDisk to store Lectures: amzn.to/3HKafEs
✨My Laptop: amzn.to/44w12ct
✨My Monitor: amzn.to/3LCG6YL
My UPS: amzn.to/3Lydy2y
My UPS old: amzn.to/3LXT0C3
✨My Mouse: amzn.to/3LYmJdY
✨My Keyboard: amzn.to/3NJs4ah
Resources you can try:
Learn Coding: • Complete RoadMap for C...
🎥Channel Playlists
🎥 Baap Graph Series - by Aryan: • Baap Graph Series - by...
🎥Dynamic Programming: • Complete Dynamic Progr...
🎥Bit Manipulation: • Complete BIT MANIPULAT...
🎥Mathematics for DSA: • Complete Mathematics f...
🎥Leetcode Top Interview Questions: • FAANG & Leetcode Inter...
🎥Codeforces Problem B Ladder: • Complete PROBLEM B LAD...
🎥Codeforces Problem C Ladder: • Codeforces PROBLEM C L...
🎥Codeforces Problem D Ladder: • Complete PROBLEM D LAD...
🎥 Top 150 Interview Questions: • Top 150 Interview Ques...
🎥 Complete Array Problem Playlist: • Complete Array Intuit...
🎥 Complete Binary Search Problem Playlist: • Complete Binary Search...
🎥 Complete Stack Playlist: • Complete Stack & Queue...
🎥 Complete Graph Problem Playlist: • Complete Graph Intuiti...
🎥 Complete TREE Playlist: • Complete TREE Intuitio...
🎥 Complete DP Problem Solving: • Complete DP Intuition ...
🎥 Complete Linked List: • Complete Linked List I...
🎥 Complete Greedy Problem Playlist: • Complete Greedy Intui...
🎥 Complete Divide & Conquer Algorithm Playlist: • Complete Divide & Conq...
🎥 Complete Trie Playlist: • Complete Trie Intuitio...
🎥 Complete Mathematics & Number Theory Problems: • Complete Mathematics &...
About Channel:
We teach about how you can grow in life & educate about programming in Fun & Intuitional way.
About Me:
I am Aryan Mittal - a Software Engineer, Speaker, Creator & Educator. During my free time, I create programming education content on this channel & also how to use that to grow :)
✨ Timelines✨
0:00 - Bakwas
1:00 - Problem Explanation
1:46 - Approach 1
2:48 - Approach 2 (Intuition + Logic)
7:48 - Approach 3 (Intuition + Logic)
12:10 - Approach 3 (Code)
18:20 - Approach 4 (Building Up)
23:00 - Approach 4 (Intuition +Logic )
35:00 - Approach 4 (Code)
✨ Hashtags ✨
#programming #Interviews #leetcode #faang #maang #datastructures #algorithms

Пікірлер: 50

  • @ARYANMITTAL
    @ARYANMITTAL Жыл бұрын

    Don't know what Leetcode smoked before placing this question in a Medium Category 🥵!! Checkout DSA-169 Series: kzread.info/dash/bejne/Z3aprbiMXbnUp9Y.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 Жыл бұрын

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

  • @sherlockjunior8612
    @sherlockjunior8612 Жыл бұрын

    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...

  • @monty6393

    @monty6393

    Жыл бұрын

    Yeah exactly

  • @shreyanshthakur5405
    @shreyanshthakur5405 Жыл бұрын

    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 Жыл бұрын

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

  • @santoshprasadyadav2198
    @santoshprasadyadav219823 күн бұрын

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

  • @oqant0424
    @oqant0424 Жыл бұрын

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

  • @jamjam3448
    @jamjam344812 күн бұрын

    My favorite man. Thanks, man

  • @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.

  • @nikhilbabar2226
    @nikhilbabar2226 Жыл бұрын

    Why the solution 3 doesn't work for negative numbers

  • @worldfromhome4033
    @worldfromhome4033 Жыл бұрын

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

  • @midas8003
    @midas8003 Жыл бұрын

    Loved the approach bro !

  • @tejuschaturvedi6234
    @tejuschaturvedi6234 Жыл бұрын

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

  • @nadeking1530
    @nadeking1530 Жыл бұрын

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

  • @bkmeher9005
    @bkmeher90055 ай бұрын

    Great bhai

  • @rishabhgupta9846
    @rishabhgupta9846 Жыл бұрын

    Thanks for the video

  • @aftabrahman5863
    @aftabrahman58635 ай бұрын

    great work

  • @shashikiran5385
    @shashikiran5385Ай бұрын

    you're underrated

  • @kale-lb5pr
    @kale-lb5pr3 ай бұрын

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

  • @iWontFakeIt
    @iWontFakeIt Жыл бұрын

    Last approach was ❤

  • @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; } };

  • @kale-lb5pr
    @kale-lb5pr3 ай бұрын

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

  • @AanganwadiGuriya
    @AanganwadiGuriya10 ай бұрын

    It was nice one !

  • @rohanpradhan3160
    @rohanpradhan3160 Жыл бұрын

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

  • @nikeshmali8506
    @nikeshmali8506 Жыл бұрын

    thanks.

  • @saunaknandi1814
    @saunaknandi181410 ай бұрын

    Aryan can u make complete video dedicated to bit manipulation?

  • @pindersingh4924
    @pindersingh4924 Жыл бұрын

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

  • @45_ritiksharma32
    @45_ritiksharma32 Жыл бұрын

    Please solve longest palindromic subsequence leetcode -2484

  • @NihalSingh-ld2en
    @NihalSingh-ld2en Жыл бұрын

    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 int sum = 0; for (int j = 0; j sum += (nums[j] >> i) & 1; } sum = sum % 3; ans = ans | (sum

  • @a.y_u.s_h
    @a.y_u.s_h Жыл бұрын

    salute

  • @arihantjainajbil8182
    @arihantjainajbil8182 Жыл бұрын

    approach 4 is lit

  • @BiswajitDas-lk7pp
    @BiswajitDas-lk7pp4 ай бұрын

    Best Explanation but sound is not Clear

  • @kale-lb5pr
    @kale-lb5pr3 ай бұрын

    array needs to be sorted i guess

  • @kale-lb5pr
    @kale-lb5pr3 ай бұрын

    #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 int sum = 0; for (int j = 0; 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 Жыл бұрын

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

  • @peachpink2831

    @peachpink2831

    Жыл бұрын

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

  • @kartikeyrana3736

    @kartikeyrana3736

    Жыл бұрын

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

  • @noobnessmee

    @noobnessmee

    Жыл бұрын

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

  • @rohanpradhan3160

    @rohanpradhan3160

    Жыл бұрын

    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

    Жыл бұрын

    @@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.✌️

Келесі