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

 

simona1@sfusd.edu morearraylist > wiseGuys
prev  |  next  |  chance

An array list contains the ages of married couples in a village. The ages are listed in pairs, so if there are two couples, ages 50, 52 and 35, 30 they would be listed in the array list as {50, 52, 35, 30}. The village considers the wisest couple to be the one with the highest combined age. Return the combined age of the wisest couple. There will be an even number of elements in the array list.


wiseGuys([20, 18]) → 38
wiseGuys([30, 33, 40, 21]) → 63
wiseGuys([25, 25, 30, 29, 60, 62]) → 122

...Save, Compile, Run (ctrl-enter)

public int wiseGuys(ArrayList<Integer> agesList){ }

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

Post-solution available

Copyright Nick Parlante 2017 - privacy