id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > proSumLowHigh
prev  |  next  |  chance

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)

public int proSumLowHigh(int[] nums){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 250

Copyright Nick Parlante 2017 - privacy