wes d2a2ba9e15 first commit пре 4 година
..
README.md d2a2ba9e15 first commit пре 4 година
code.cpp d2a2ba9e15 first commit пре 4 година
unitTest.cpp d2a2ba9e15 first commit пре 4 година

README.md

All Rotations of a String

by Helen Yu tags: strings, loops

Summary

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", "

Instructions

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", "efabcd", "defabc", "cdefab", "bcdefa"]

Notes

N/A