info@onlinelearningcenter.in (+91) 7 999 01 02 03 Get started with 45 Hours of Free course right now 

Split the array and add the first part to the end

Jaivik Shah
6 Posts

Split the array and add the first part to the end.

There is a given array and split it from a specified position, and move the first part of the array add to the end. 

Example 1:

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 .

 

 Example 2:

Input:

arr[] = {3, 1, 2}
k = 1

 

 Output:

arr[] = {1, 2, 3}

 

 Explanation:

Split from index 1 and first part add to the end.

 

 

Published By : Jaivik Shah
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Comments