Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
bitcount algo
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { Console.WriteLine(SparseBitcount(0)); Console.WriteLine(SparseBitcount(1)); Console.WriteLine(SparseBitcount(int.MaxValue)); Console.WriteLine(SparseBitcount(256)); } static int SparseBitcount(int n) { int count = 0; while (n != 0) { count++; n &= (n - 1); } return count; } } }
run
|
edit
|
history
|
help
1
test
Binary search tree - In-order Traversal
Stacks: Balanced Brackets -final
FileNameCharCheck
Game Dev Challenge #1
Par ou ímpar input
c# string abbreviation
Intuit // C# // listing_4.3 (StreamWriter // output.txt)
sdfgthyjuiujy7htgrf
Bg