You are viewing a single comment's thread. Return to all comments →
C# like most, but just transform the array to one of lengths and take max.
static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); var b = Convert.ToString(n,2); string[] arr = b.Split('0').ToArray(); int c = arr.Select(x => x.Length).Max(); Console.WriteLine(c); }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →
C# like most, but just transform the array to one of lengths and take max.