about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 299
Copyright Nick Parlante 2017 - privacy