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
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
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
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
Жыл бұрын
Yeah exactly
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!!!
Thank you, Aryan! It's a beautiful video. Helped me improve my thought process. Glad that I came across your channel.
Loved the way you explained bro, best video for this question i found so far!!
beautifully explained.......................the only person on the whole internet who teaches how to build the solution❤❤
My favorite man. Thanks, man
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.
Why the solution 3 doesn't work for negative numbers
Nice idea of encapsulating the set bits that have come once and twice and then modifying them🔥
Loved the approach bro !
Mind blowing explanation 💫. The last approach is so amazing . You are very good at this explanatory work . ❤
You earned a sub ! Kudos to your hard work !!!
Great bhai
Thanks for the video
great work
you're underrated
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!!
Last approach was ❤
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; } };
how bit manipulation is taking place pls help im doing dr and run im not getting?
It was nice one !
Loved the approach and how you got to it.. Loved it Thanks......
thanks.
Aryan can u make complete video dedicated to bit manipulation?
i start my day with solving leetcode problem of the day , and then during breakfast i watch your solution video , love your videos.
Please solve longest palindromic subsequence leetcode -2484
did you tried to submit your 3rd intution code ? as the number can be negative this intution will not work
@nikhilbabar2226
Жыл бұрын
Yes, it is not working for negative numbers
@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
salute
approach 4 is lit
Best Explanation but sound is not Clear
array needs to be sorted i guess
#include using namespace std; int singleNumII(vector a,int n) { int ones=0,twos=0; int i; for(i=0;i
class Solution { public: int singleNumber(vector& nums) { int ans = 0; for(int i=0;i
@GOLUKUMAR-zi9nv
Жыл бұрын
It doesn't work for negative numbers
@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
too much for me ! 😢
forrr 22222
38 min video 🤦🏻♂️. Who's gonna waste time.. why can't you make under 20 min video or split the video
@peachpink2831
Жыл бұрын
why can't you check timestamp and skip to the part u need, you don't need to watch all 4 approaches
@kartikeyrana3736
Жыл бұрын
same lol, i'm waiting for neetcode to start uploading again, till then will have to make do with him.
@noobnessmee
Жыл бұрын
he can just cut his overactting and video would be 20 mins lol
@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
Жыл бұрын
@@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.✌️