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

 

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

Write a method that accepts an array of positive integers with at least one element in the array. Your goal is to find the greatest sum of the digits of any element in the array and return the index of that element. There will not be any ties. For example, the largest sum of the digits of any one element in this array: {142, 3213, 929, 50004, 10000} is 20 (9+2+9) which is at array index 2, so you would return a 2.


testHL_Q12_V2([6, 7, 3, 600000, 120, 70001, 2, 1]) → 5
testHL_Q12_V2([4522, 214, 84, 214, 10200]) → 0
testHL_Q12_V2([42245, 98543, 24, 3, 9, 99, 89]) → 1

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

public int testHL_Q12_V2(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: 299

Copyright Nick Parlante 2017 - privacy