about | help | code help+videos | done | prefs |
Write a method that accepts a string 'str' and how many characters you want to swap 'swap' between the front and back of the string. Note the order that the characters are swapped. As a precondition you may assume that 'swap' will be less than half the length of the string. Look at the test data for examples. quiz2022_02_24_APSLHL_swapN("abcdefghijklmn", 2) → "nmcdefghijklba" quiz2022_02_24_APSLHL_swapN("12345ABCDE", 3) → "EDC45AB321" quiz2022_02_24_APSLHL_swapN("This is a quiz of much awesomeness", 6) → "ssenems a quiz of much awesoi sihT" ...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: 250
Copyright Nick Parlante 2017 - privacy