Question: ( Write the code in C programming ) 1 . Problem statement Given an array / list 'ARR' of integers and a position M .

(Write the code in C programming)
1. Problem statement
Given an array/list 'ARR' of integers and a position M. You have to reverse the array after that position.
Example:
We have an array ARR ={1,2,3,4,5,6} and M =3, considering 0
based indexing so the subarray {5,6} will be reversed and our
output array will be {1,2,3,4,6,5}.
Detailed explanation ( Input/output format, Notes)
Constraints:
1<= T <=10
0<= M <= N <=5*10^4
-10^9<= ARR[i]<=10^9
Time Limit: 1 sec
Sample Input 1:
2--> No. queries
63---> Array Length, position M
123456---> Array
52---> Array Length, position M
109876---> Array
Sample Output 1:
123465
109867
Explanation 1:
For the first test case,
Considering 0-based indexing we have M =3 so the
subarray[M+1... N-1] has to be reversed.
Therefore the required output will be {1,2,3,4,6,5}.
For the second test case,
Considering 0-based indexing we have M =2 so the
subarray[M+1... N-1] has to be reversed.
Therefore the required output will be {10,9,8,6,7}.
Sample Input 2:
2
73
1456677
93
1045236136
Sample Output 2: 14567761045263163

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!