String Rotate Left
Write a function called rotateLeft
that takes a String
as its first argument and a non-negative int
as
its second argument and rotates the String
left by the given number of characters.
Here's what we mean by rotate:
CS125
rotated left by 1 becomesS125C
CS125
rotated left by 2 becomes125CS
CS125
rotated left by 3 becomes25CS1
And so on.
Notice how characters rotated off the left end of the String
wrap around to the right.
This problem is similar to one that you have done before, but has a new wrinkle.
If the passed String
argument is null
, you should return null
.
Good luck and have fun!