about | help | code help+videos | done | prefs |
Write a method that returns a string where all the pairs of characters have had their positions swapped, starting at the beginning of the string. If the string has an odd number of characters the last character will not get swapped with anything but will still be in the new string. The only string methods you are allowed to use are .length, .substring, .charAt, and .equals. dec9_2016_APSLHL_swapPairs("") → "" dec9_2016_APSLHL_swapPairs("x") → "x" dec9_2016_APSLHL_swapPairs("xy") → "yx" ...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: 240
Copyright Nick Parlante 2017 - privacy