Numbers
Data Types
Integers
Algorithms
Logic
Find the shortest or fastest answer.
public class Kumite { // Unrolled div loop public static int Digits(ulong n) => n.ToString().Length; }
- public class Kumite
- {
- // Unrolled div loop
public static int Digits(ulong n){var l = 1;while(true){if (n < 10) return l;if (n < 100) return l + 1;if (n < 1000) return l + 2;if (n < 10000) return l + 3;n /= 10000;l += 4;}}- public static int Digits(ulong n) => n.ToString().Length;
- }