Algorithms Challenge - #3: String Transform

Implement a function that moves the first character of a string to the end, returning the transformed string. If the input is empty, return an empty string.

Examples:

  • rotate_left("hello") returns elloh
  • rotate_left("a") returns a
  • rotate_left("") returns ""
def rotate_left(s: str) -> str:\n    pass

Rules:

  • Any language or pseudocode is fine. The stub just shows the shape.
  • Say the time complexity of your approach.
  • short rule
  • one well defined function with input and output
  • 2 to 4 word topic label

Post your solution as a reply. Answer goes up in about a day.