Ad
Algorithms
Code
Diff
  • fn digits(n: u64) -> usize {
        n.to_string().chars().count()
    }
    • fn digits(mut n: u64) -> usize {
    • std::iter::from_fn(|| { n = n / 10; Some(n) }).
    • take_while(|n| *n > 0)
    • .count() + 1
    • fn digits(n: u64) -> usize {
    • n.to_string().chars().count()
    • }