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

 

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

Write a RECURSIVE method that returns a string showing all the numbers from 0 up to and (possibly) including 'maxNum' with a comma in between each number. However, you are not including ALL the numbers from 0 up to 'numMax' because you are skipping by 'skip', then 2*'skip', then 3*'skip', etc. You may or may not include 'maxNum' depending on how it lands. Look at the test data and make sure you understand when the results are the way they are. Your solution MUST be recursive. You may assume that 'num' will be non-negative. For example, if 'num' was 5 you would return "0,1,2,3,4,5". Look at the test data for other examples.


numListSkip(0, 1) → "0"
numListSkip(1, 1) → "0,1"
numListSkip(10, 2) → "0,2,6"

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

public String numListSkip(int maxNum, int skip) { }

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

Copyright Nick Parlante 2017 - privacy