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

  Рет қаралды 7,387

Code with Alisha

Code with Alisha

2 жыл бұрын

Connect with me on LinkedIn : / alisha-parveen-80579850
Check out our other playlists:
Dynamic Programming:
• Dynamic Programming
Trees:
• Trees
Heaps and Maps:
• Heaps and Maps
Arrays and Maths:
• Arrays and Maths
Bit Manipulation:
• Bit Manipulation
Greedy Algorithms:
• Greedy Algorithms
Sorting and Searching:
• Sorting and Searching
Strings:
• Strings
Linked Lists:
• Linked Lists
Stack and Queues:
• Stacks and Queues
Two Pointers:
• Two pointers
Graphs, BFS, DFS:
• Graphs, DFS, BFS
Backtracking:
• Backtracking
Non- DSA playlists:
Probability:
• Probability
SQL-Basic Join functions:
• SQL - Basic JOIN Funct...
SQL-Basic Aggregate functions:
• SQL-Basic Aggregate Fu...

Пікірлер: 20
@probabilitycodingisfunis1
@probabilitycodingisfunis1 2 жыл бұрын
vectorans(n+1,0); for(int i=0;i
@satvikarya569
@satvikarya569 2 жыл бұрын
Can you please tell me how the binary value of a number is getting assigned to the variable 'num'?
@onkarsangale6222
@onkarsangale6222 11 ай бұрын
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; } };
@Gauravkumar-lv7xd
@Gauravkumar-lv7xd 10 күн бұрын
thanks its very usefull
@JaJa-tp9ck
@JaJa-tp9ck 2 жыл бұрын
Awesome job Alisha. I just found out about this channel and I'm definitely here to stay.
@AMITKUMAR-xv2ny
@AMITKUMAR-xv2ny 6 ай бұрын
Awesome ...
@dhananjoydey1337
@dhananjoydey1337 2 жыл бұрын
N is given in decimal but when we are iterating over N how we can find 1 and 0s?
@shikha2121
@shikha2121 Жыл бұрын
Yours is the simpleest explanation I found
@saikrishna-cy2tr
@saikrishna-cy2tr 10 ай бұрын
the way you explained the solution was awesome dear
@khushil9988
@khushil9988 2 ай бұрын
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
@manideep7148
@manideep7148 Жыл бұрын
Excellent Explanation Alisha. Subscribed ;)
@kunalkheeva
@kunalkheeva Жыл бұрын
ty
@piyush2750
@piyush2750 2 жыл бұрын
Thankyou for super easy explanation
@sreeharia2356
@sreeharia2356 2 жыл бұрын
Nice explanation 🔥
@commandermsv3329
@commandermsv3329 2 жыл бұрын
Good Work
@babushaikh6582
@babushaikh6582 2 жыл бұрын
Nice explanation 🎇
@Rajat_maurya
@Rajat_maurya 2 жыл бұрын
Thanks
@prashantshukla7477
@prashantshukla7477 Жыл бұрын
thanks
@sahityaraj9417
@sahityaraj9417 Жыл бұрын
Op❤
@n1111shant
@n1111shant 11 ай бұрын
yrr aap muche kaat leti
Bitwise AND of the Array GeeksforGeeks Problem of the Day
34:07
Code with Alisha
Рет қаралды 4,1 М.
Why Is He Unhappy…?
00:26
Alan Chikin Chow
Рет қаралды 67 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 29 МЛН
Number of 1 Bits | Live Coding with Explanation | Leetcode - 191
7:32
Algorithms Made Easy
Рет қаралды 17 М.
Longest subarray with sum divisible by K | GfG problem of the day
16:48
Code with Alisha
Рет қаралды 10 М.
Counting Bits - Dynamic Programming - Leetcode 338 - Python
13:24
Reverse Bits | 190. Leetcode | Python Solution
7:21
Persistent Programmer
Рет қаралды 457
Why Is He Unhappy…?
00:26
Alan Chikin Chow
Рет қаралды 67 МЛН