String Rotate Left

Geoffrey Challen // 2020.9.0

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 becomes S125C
  • CS125 rotated left by 2 becomes 125CS
  • CS125 rotated left by 3 becomes 25CS1

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!