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

Java > String-2 > repeatEnd
prev  |  next  |  chance

Given a string and an int N, return a string made of N repetitions of the last N characters of the string. You may assume that N is between 0 and the length of the string, inclusive.

repeatEnd("Hello", 3) → "llollollo"
repeatEnd("Hello", 2) → "lolo"
repeatEnd("Hello", 1) → "o"

...Save, Compile, Run

See also Java Example Code. Java help docs: If Boolean Logic | Strings | While and For Loops | Arrays and Loops


prev  |  next  |  chance   |  CodingBat  >  String-2

Forget It! -- delete my code for this problem 230.0

Copyright Nick Parlante 2006-10 - privacy