about | help | code help+videos | done | prefs |
Write a method that accepts an array of positive integers. Return the product of the highest and lowest integers in the array added to the sum of all the other integers in the array. However, if the highest or lowest numbers appear more than once, they only count once towards the product and do not count at all towards the sum of the remaining integers. For example: proSumLowHigh({2, 3, 5, 8, 4, 2, 2, 7, 4, 8}) returns 39 because 2*8=16 and 3+5+4+7+4=23 for a final sum of 39. The array will contain at least two different integers. proSumLowHigh([2, 3, 5, 8, 4, 2, 2, 7, 4, 8]) → 39 proSumLowHigh([1, 1, 3, 3, 3]) → 3 proSumLowHigh([4, 6]) → 24 ...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