Number of 1 Bits | Live Coding with Explanation | Leetcode - 191

preview_player
Показать описание
This video explains 2 Approaches and a recursive solution with follow up for number of 1 bits leetcode 191

To support us you can donate

Check out our other popular playlists:

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #leetcode #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode
Рекомендации по теме
Комментарии
Автор

We hope you all are enjoying our videos!!! Don't forget to leave a comment!!! Please like the video to support us!!!

Questions you might like:

Struggling in a question??

Leave in a comment and we will make a video!!!🙂🙂🙂

AlgorithmsMadeEasy
Автор

Thank you for such great explanation and clear approach!!

harshamadhwani
Автор

im so happy to have found this yet im so confused.

malkomeks
Автор

Instead of num & 1, I tried for(i=0; i<32; ++i) if(num%1==1) {count++; num>>>1;} in Java. It didn't work for a few cases. Does anyone know why?

darshanv
Автор

please explain...i am not getting the code dry run

nikhilpoonia
Автор

why can't we use the left shift instead of the right shift.

anushkasiddhu
Автор

Can anyone explain the time complexity in detail of solution 2? From my understanding, I know it is because numbers are 32 bits integer, then worst case time complexity is O(32) which is O(1).

Ben-pbct
Автор

why is this code not working ??

class Solution {
public:
int hammingWeight(uint32_t n) {

int cnt =0 ;
while (n!=0)
{
if(n%10==1)
cnt++;
n=n/10;
}
return cnt;

}
};

puspaulmukhopadhyay