You are viewing a single comment's thread. Return to all comments →
An ifless (atleast on the surface, I know int.CompareTo() uses if inside it) O(n) solution with C#
var numbers = new decimal[3]; foreach (var t in arr) { numbers[t.CompareTo(0) + 1]++; } Console.WriteLine(numbers[2] / arr.Length); Console.WriteLine(numbers[0] / arr.Length); Console.WriteLine(numbers[1] / arr.Length);
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
An ifless (atleast on the surface, I know int.CompareTo() uses if inside it) O(n) solution with C#