about | help | code help+videos | done | prefs |
(EASY) Given an input String and a key n, rotate-right the positions of all the characters in the String within the length n subgroups. So if n is 2 this means "ABCD" becomes "BADC" and "AHOY MATEY" becomes "HAYOM TAYE". But if n is 3, "AHOY MATE" becomes "OAHMY EAT" instead because the group size is 3. Preconditions: str.length() % n == 0, and n > 1. apcsaEncryptRotatePositions("ABCD", 2) → "BADC" apcsaEncryptRotatePositions("ab", 2) → "ba" apcsaEncryptRotatePositions("The clue was always in your head", 8) → "eThe cluw was alyays in dour hea" ...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: 310
Copyright Nick Parlante 2017 - privacy