1390. Four Divisors Medium
1/**
2 * [1390] Four Divisors
3 *
4 * Given an integer array nums, return the sum of divisors of the integers in that array that have exactly four divisors. If there is no such integer in the array, return 0.
5 *
6 * Example 1:
7 *
8 * Input: nums = [21,4,7]
9 * Output: 32
10 * Explanation:
11 * 21 has 4 divisors: 1, 3, 7, 21
12 * 4 has 3 divisors: 1, 2, 4
13 * 7 has 2 divisors: 1, 7
14 * The answer is the sum of divisors of 21 only.
15 *
16 * Example 2:
17 *
18 * Input: nums = [21,21]
19 * Output: 64
20 *
21 * Example 3:
22 *
23 * Input: nums = [1,2,3,4,5]
24 * Output: 0
25 *
26 *
27 * Constraints:
28 *
29 * 1 <= nums.length <= 10^4
30 * 1 <= nums[i] <= 10^5
31 *
32 */
33pub struct Solution {}
34
35// problem: https://leetcode.com/problems/four-divisors/
36// discuss: https://leetcode.com/problems/four-divisors/discuss/?currentPage=1&orderBy=most_votes&query=
37
38// submission codes start here
39
40impl Solution {
41 pub fn sum_four_divisors(nums: Vec<i32>) -> i32 {
42 0
43 }
44}
45
46// submission codes end
47
48#[cfg(test)]
49mod tests {
50 use super::*;
51
52 #[test]
53 fn test_1390() {
54 }
55}
56
Back
© 2025 bowen.ge All Rights Reserved.