wes d2a2ba9e15 first commit | 4 tahun lalu | |
---|---|---|
.. | ||
README.md | 4 tahun lalu | |
code.cpp | 4 tahun lalu | |
unitTest.cpp | 4 tahun lalu |
by Helen Yu tags: strings, loops
Create a left rotation and a right rotation function that returns all the left rotations and right rotations of a string. Examples leftRotations("abc") ➞ ["abc", "bca", "cab"] rightRotations("abc") ➞ ["abc", "cab", "bca"] leftRotations("abcdef") ➞ ["abcdef", "bcdefa", "cdefab", "defabc", "efabcd", "fabcde"] rightRotations("abcdef") ➞ ["abcdef", "fabcde", "
Create a left rotation and a right rotation function that returns all the left rotations and right rotations of a string.
leftRotations("abc") ➞ ["abc", "bca", "cab"]
rightRotations("abc") ➞ ["abc", "cab", "bca"]
leftRotations("abcdef")
➞ ["abcdef", "bcdefa", "cdefab", "defabc", "efabcd", "fabcde"]
rightRotations("abcdef")
➞ ["abcdef", "fabcde", "efabcd", "defabc", "cdefab", "bcdefa"]
N/A