Тёмный

Leetcode 338. Counting Bits | Bit Manipulation | Brute Force to Optimal | 2 Solutions with full code 

Code with Alisha
Подписаться 29 тыс.
Просмотров 8 тыс.
50% 1

Опубликовано:

 

26 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 21   
@probabilitycodingisfunis1
@probabilitycodingisfunis1 2 года назад
vectorans(n+1,0); for(int i=0;i
@onkarsangale6222
@onkarsangale6222 Год назад
This makes much more sense instead of % 2 we can use &1 which return 1 if bit is 1 and 0 when bit is 0; and we can right shift num by 1 class Solution { public: vector countBits(int n) { vector ans; for(int i=0;i>1; } ans.push_back(sum); } return ans; } };
@satvikarya569
@satvikarya569 2 года назад
Can you please tell me how the binary value of a number is getting assigned to the variable 'num'?
@free_bird_emu
@free_bird_emu Месяц назад
Thank you so much for effort . it is simple logic and so easy to get understand. 💌
@saikrishna-cy2tr
@saikrishna-cy2tr Год назад
the way you explained the solution was awesome dear
@shikha2121
@shikha2121 Год назад
Yours is the simpleest explanation I found
@JaJa-tp9ck
@JaJa-tp9ck 2 года назад
Awesome job Alisha. I just found out about this channel and I'm definitely here to stay.
@Gauravkumar-lv7xd
@Gauravkumar-lv7xd 3 месяца назад
thanks its very usefull
@kunalkheeva
@kunalkheeva Год назад
ty
@manideep7148
@manideep7148 Год назад
Excellent Explanation Alisha. Subscribed ;)
@khushil9988
@khushil9988 5 месяцев назад
how diving the num by 2 removing 1 value from the unit place i think it's done by dividing it by 10 1011/2 = 505 1011/10 = 101 and that's what we want here
@dhananjoydey1337
@dhananjoydey1337 2 года назад
N is given in decimal but when we are iterating over N how we can find 1 and 0s?
@AMITKUMAR-xv2ny
@AMITKUMAR-xv2ny 8 месяцев назад
Awesome ...
@piyush2750
@piyush2750 2 года назад
Thankyou for super easy explanation
@prashantshukla7477
@prashantshukla7477 Год назад
thanks
@commandermsv3329
@commandermsv3329 2 года назад
Good Work
@babushaikh6582
@babushaikh6582 2 года назад
Nice explanation 🎇
@sahityaraj9417
@sahityaraj9417 Год назад
Op❤
@n1111shant
@n1111shant Год назад
yrr aap muche kaat leti
@Rajat_maurya
@Rajat_maurya 2 года назад
Thanks
@sreeharia2356
@sreeharia2356 2 года назад
Nice explanation 🔥
Далее
Физика пасты Карбонара 🧪🔬
00:57
I Solved 100 LeetCode Problems
13:11
Просмотров 169 тыс.
Leetcode 894. All Possible Full Binary Trees
29:08
Просмотров 4,2 тыс.
Counting Bits | Leetcode #338
11:51
Просмотров 70 тыс.
Физика пасты Карбонара 🧪🔬
00:57