about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy