#47 - Rotate Array by one position
Example 1
Input
nums = [1, 2, 3, 4, 5]
direction = "left"Output
[2, 3, 4, 5, 1]Example 2
Input
nums = [1, 2, 3, 4, 5]
direction = "right"Output
[5, 1, 2, 3, 4]Last updated