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

 

String-1 > right2
prev  |  next  |  chance

Given a string, return a "rotated right 2" version where the last 2 chars are moved to the start. The string length will be at least 2.


right2("Hello") → "loHel"
right2("java") → "vaja"
right2("Hi") → "Hi"

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

public String right2(String str) { }

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

Copyright Nick Parlante 2017 - privacy