1399. Count Largest Group Easy
1/**
2 * [1399] Count Largest Group
3 *
4 * You are given an integer n.
5 * Each number from 1 to n is grouped according to the sum of its digits.
6 * Return the number of groups that have the largest size.
7 *
8 * Example 1:
9 *
10 * Input: n = 13
11 * Output: 4
12 * Explanation: There are 9 groups in total, they are grouped according sum of its digits of numbers from 1 to 13:
13 * [1,10], [2,11], [3,12], [4,13], [5], [6], [7], [8], [9].
14 * There are 4 groups with largest size.
15 *
16 * Example 2:
17 *
18 * Input: n = 2
19 * Output: 2
20 * Explanation: There are 2 groups [1], [2] of size 1.
21 *
22 *
23 * Constraints:
24 *
25 * 1 <= n <= 10^4
26 *
27 */
28pub struct Solution {}
29
30// problem: https://leetcode.com/problems/count-largest-group/
31// discuss: https://leetcode.com/problems/count-largest-group/discuss/?currentPage=1&orderBy=most_votes&query=
32
33// submission codes start here
34
35impl Solution {
36 pub fn count_largest_group(n: i32) -> i32 {
37 0
38 }
39}
40
41// submission codes end
42
43#[cfg(test)]
44mod tests {
45 use super::*;
46
47 #[test]
48 fn test_1399() {
49 }
50}
51
Back
© 2025 bowen.ge All Rights Reserved.