BETA

Difficulty Level: Easy

Submissions: 969 Accuracy:

39.42%

Consecutive Array Elements
     

Given an unsorted array of numbers, write a function that test whether array consists of consecutive numbers.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the size of the array. The following line contains n space separated integers forming the array.

Output:
Print "Yes" (without quotes) if array elements are consecutive.
Print "No" (without quotes) if array elemetns are non-consecutive.

Constraints:
1<=T<=10^2
1<=n<=10^5
1<=a[i]<=10^5

Example:
Input:

4
6
5 4 2 3 1 6
6
83 78 80 81 79 82
5
34 23 52 12 3
6
7 6 5 5 3 4

Output:
Yes
Yes
No
No

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

Contributor: Saksham Raj Seth

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.