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

 

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

This is based on the SLHL problem 'recursiveSumDigits'. You are allowed to copy and paste code from that problem into this one if it helps. Write a method that returns the "recursive sum of the digits" of all the integers from 'first' to 'last', inclusive. The results are returned in an array of integers with the index of that array indicating how far above 'first' you are. In other words, if 'first' is 50 and the index of an element in the array is 3, the number in that position in the array represents the recursiveSumDigits of 53 (which is 8). As preconditions, you may assume that 'first'>0 and 'last'>='first'. Look at the test data for examples.


test2024_11_21_HL_recursiveSumDigitsFromTo(894, 895) → [3, 4]
test2024_11_21_HL_recursiveSumDigitsFromTo(989352, 989354) → [9, 1, 2]
test2024_11_21_HL_recursiveSumDigitsFromTo(1724, 1731) → [5, 6, 7, 8, 9, 1, 2, 3]

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

public int[] test2024_11_21_HL_recursiveSumDigitsFromTo(int first, int last) { }

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: 430

Copyright Nick Parlante 2017 - privacy