Question: 2. Groovy - Largest Subset Sum For each number in an array, get the sum of its factors. Return an array of results. Example arr
- 2. Groovy - Largest Subset Sum For each number in an array, get the sum of its factors. Return an array of results. Example arr = [12] The factors of arr[0] = 12 are [1, 2, 3, 4, 6, 12]. The sum of these factors is 28. Return the array [28]. Function Description Complete the function maxSubsetSum in the editor below. maxSubsetSum has the following parameter(s): int arrin]: an array of integers Returns longin]: the sums calculated for each arr[i] Constraints • 1 sn≤ 103 • 1 sarrlil = 10°
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
