BETA

Difficulty Level:

Basic

Total Submissions: 1002 Accuracy:

16.07%

Part Sort
     

Given an array A[N], you are required to sort the array in given index range [a, b], i.e., you need to sort subarray A[a..b]

Example:
Input: 

A[] = {7, 8, 4, 5, 2}
a = 1 , b = 4
Output : 
 7 2 4 5 8

Example : 
Input : 

The first line of input contains an integer T denoting the Test cases. Then T test cases follow. 
First line contains no. of array elements - N
Second line contains array elements A[i]
Third line contains a and b

Output : 
Sorted array as per the given range [a, b] 

Constraints :
1 ≤ T ≤ 100
1 ≤ N ≤ 10^5
0 ≤ A[i] ≤ 10^6
0 ≤ a, b ≤ N-1

Input : 
1
5
7 8 4 5 2
1 4

Output : 
7 2 4 5 8

 

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Mohit Gupta_OMG :)

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.