dsa · easy

Sum of Odd Divisors

GreyOrangeMathArrayFoundation

For each number in nums, sum its **odd** positive divisors. Return the total of those sums.

Arguments

**Example:** [1, 4, 7]1 + 1 + (1+7) = 10.

GreyOrange OA (asked twice independently). 4’s odd divisors are {1} only.

Constraints

1 <= nums.length <= 1000, 1 <= nums[i] <= 10^6 Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.

Examples

Example 1

Input:
[1,4,7]

Expected:
10

Example 2

Input:
[1]

Expected:
1

Open in the Dojo editor