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
532
pyramidnos
3
D18
asxsd
Dokkan 2.0
Free v Bucks Codes
Time diff with date list
ProtectedUse
General.cs