3622. Check Divisibility by Digit Sum and Product Easy
1/**
2 * [3622] Check Divisibility by Digit Sum and Product
3 *
4 * You are given a positive integer n. Determine whether n is divisible by the sum of the following two values:
5 *
6 *
7 * The digit sum of n (the sum of its digits).
8 *
9 *
10 * The digit product of n (the product of its digits).
11 *
12 *
13 * Return true if n is divisible by this sum; otherwise, return false.
14 *
15 * <strong class="example">Example 1:
16 * <div class="example-block">
17 * Input: <span class="example-io">n = 99</span>
18 * Output: <span class="example-io">true</span>
19 * Explanation:
20 * Since 99 is divisible by the sum (9 + 9 = 18) plus product (9 * 9 = 81) of its digits (total 99), the output is true.
21 * </div>
22 * <strong class="example">Example 2:
23 * <div class="example-block">
24 * Input: <span class="example-io">n = 23</span>
25 * Output: <span class="example-io">false</span>
26 * Explanation:
27 * Since 23 is not divisible by the sum (2 + 3 = 5) plus product (2 * 3 = 6) of its digits (total 11), the output is false.
28 * </div>
29 *
30 * Constraints:
31 *
32 * 1 <= n <= 10^6
33 *
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/check-divisibility-by-digit-sum-and-product/
38// discuss: https://leetcode.com/problems/check-divisibility-by-digit-sum-and-product/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43 pub fn check_divisibility(n: i32) -> bool {
44 false
45 }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52 use super::*;
53
54 #[test]
55 fn test_3622() {
56 }
57}
58Back
© 2026 bowen.ge All Rights Reserved.