about | help | code help+videos | done | prefs |
Write a method that finds the sum of all the integers in the 'nums' array, except do not include any of the values that are multiples of the values immediately before them. For example, if 'nums' is {5,13,20,17,34,34,68,10} you would return 65 because 5+13+20+17+10=65. You would NOT include the first 34 because it is a multiple of 17 (2*17=34). You would NOT include the second 34 because it is a multiple of 34 (1*34=34). You would NOT include the 68 because it is a multiple of 34 (2*34=68). As preconditions, you may assume that 'nums' has at least one number in it and that all of the integers in 'nums' are positive. Look at the test data for examples. test2023_06_01_APP1SL_arrayFunnySum([18, 9, 3, 12, 50, 100]) → 80 test2023_06_01_APP1SL_arrayFunnySum([500]) → 500 test2023_06_01_APP1SL_arrayFunnySum([27]) → 27 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 250
Copyright Nick Parlante 2017 - privacy