(n: i32)
| 1 | pub fn count_largest_group(n: i32) -> i32 { |
| 2 | let mut count = vec![0;99]; |
| 3 | for i in 1..=n { |
| 4 | let a = i.to_string().chars().map(|c| c.to_digit(10).unwrap()).sum::<u32>(); |
| 5 | count[a as usize] += 1; |
| 6 | } |
| 7 | let m = *count.iter().max().unwrap(); |
| 8 | let mut ret = 0; |
| 9 | for i in count { |
| 10 | if i == m { |
| 11 | ret += 1; |
| 12 | } |
| 13 | } |
| 14 | ret |
| 15 | } |
| 16 | |
| 17 | fn main() { |
| 18 | println!("{:?}", count_largest_group(13)); |
nothing calls this directly
no outgoing calls
no test coverage detected