TheAlgorithms/C-Sharp

[FEATURE] Add Algorithm for counting set bits in an integer

Rytnix opened this issue · 4 comments

I propose to add [algorithm] [set bit count in a number]. It helps to solve problems such as [calculating the no of set bits ]. It's best described on the website(s): [https://www.geeksforgeeks.org/count-set-bits-in-an-integer/].

What is the algorithm you would like to add? If it i-th bit in a number, would'nt that be just something like n |= (1 << i)?

No no, This algorithm will count the no of 1's i.e set bits that is present in a number, Ex if the number is 5(101 in bits) then the set bit count will be 2.

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

This issue was closed because it has been stalled for 7 days with no activity.