Python Program to Split the array and add the first part to the end
There is a given an array and split it from a specified position, and move the first part of array add to the end.
Examples:
Input : arr[] = {12, 10, 5, 6, 52, 36} k = 2 Output : arr[] = {5, 6, 52, 36, 12, 10} Explanation : Split from index 2 and first part {12, 10} add to the end . Input : arr[] = {3, 1, 2} k = 1 Output : arr[] = {1, 2, 3} Explanation : Split from index 1 and first part add to the end.
Output:
5 6 52 36 12 10
Please refer complete article on Split the array and add the first part to the end for more details!
Another Solution :
Output:
5 6 52 36 12 10
No comments:
Post a Comment
Your feedback is highly appreciated and will help us to improve our content.