137. Single Number II | Bit Manipulation
leetcode.com/problems/single-...
0:00 - Question Understanding
1:50 - Approach
6:25 - Code
#coding #dsa #leetcode #daily #programming #cpp #tutorial
leetcode.com/problems/single-...
0:00 - Question Understanding
1:50 - Approach
6:25 - Code
#coding #dsa #leetcode #daily #programming #cpp #tutorial
Пікірлер: 13
If each one was repeated only two times it would be easier, since in that case I believe XORing the entire array together would give you the single number
@deepcodes
Жыл бұрын
Yes, absolutely!
i did this one before but didnt got any clue of how to do it with constant space now i know
Very well explained
@deepcodes
Жыл бұрын
Thanks for liking
you can use ans = ans | (setBits
@deepcodes
Жыл бұрын
Yes, good thought!
Could you please explain why you took ans as long?
Instead of calculating pow every time, we can maintain long long shift and multiply it by 2 each time in the loop. It will save time,ig.
@deepcodes
Жыл бұрын
Yeah, we can.
will this work on negative numbers ?
bhaiya kon sa pen tab use karte ho aap
@deepcodes
Жыл бұрын
XENX pen tab