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

 

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

Write a method that accepts an array of strings, then returns a new array where each string has been "shifted" by an amount equal to its index in the array. For example: {"abcd", "abcdefg", "abcde"} would produce the result of {"abcd", "bcdefga", "cdeab"}. Note that the first string is not shifted at all because it is at index zero. The second string is shifted by one because it is at index one. This pattern continues. Note that a string may have fewer characters than the index number where the string is stored in the array. In that case the shifting wraps-around. For example "abcd" at index 6 would result in "cdab". Also, remember that the index starts at zero.


airplaneNameShift(["This", "is", "amazing"]) → ["This", "si", "azingam"]
airplaneNameShift(["abcd"]) → ["abcd"]
airplaneNameShift(["abcd", "abcd", "abcd"]) → ["abcd", "bcda", "cdab"]

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

public String[] airplaneNameShift(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: 290

Copyright Nick Parlante 2017 - privacy