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

 

tlsmith2@wsfcs.k12.nc.us > echo
prev  |  next  |  chance

Given a string and an int n, return a string made of the first n characters of the string, followed by the first n-1 characters of the string, and so on. You may assume that n is between 0 and the length of the string, inclusive (i.e. n >= 0 and n <= str.length()).


echo("Chocolate", 4) → "ChocChoChC"
echo("Chocolate", 3) → "ChoChC"
echo("Ice Cream", 2) → "IcI"

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

public String echo(String str, int n) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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: 200 Post-solution available

Copyright Nick Parlante 2017 - privacy