BETA

Difficulty Level: Basic

Submissions: 321 Accuracy:

52.02%

Play with an array (Function Problem)
     

Given an unsorted array, rearrange the array such that number at the odd index is greater than the number at the previous even index. There may be multiple outputs, so your task is to complete the function and return the array.

Input:
First line consists of T test cases. First line of every test case consists of N, denoting number of elements in an array. Second line of every test case consists of elements in an array.

Output:
If Array is formed according to rules print 1, else 0.

Constraints:
1<=T<=100
1<=N<=100

Example:
Input:

2
5
5 4 3 2 1
4
4 3 2 1
Output:
1
1

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

Contributor: Saksham Raj Seth


					   
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.