15 Sep PMCA Saturday 18:30 Python Homework 21.09.11.
Posted at 03:21h in Uncategorized 0 Comments
A left rotation operation on an array of size shifts each of the array’s elements unit to the left. Given an integer, write the code to rotate the array that many steps left and return the result.
Sample Input 1:
Sample Output 1:
arr : [3,4,5,1,2]
In the array, we are left shifting the array by 2 steps. In the first steps, the first item in the array is moved to the end, so after the first step, the array will look as [2,3,4,5,1]. In the second steps, we will again move the first element of the array is moved to the end, so after the first step, the array will look as [3,4,5,1,2]
Sample Input 2
Sample Output 2
Sorry, the comment form is closed at this time.