Difficulty Level: Easy

Submissions: 1637 Accuracy:


[Check if array contains contiguous integers with duplicates allowed]

Given an array of n integers(duplicates allowed). Print “Yes” if it is a set of contiguous integers else print “No”.

INPUT: The first line consists of an integer T i.e. the number of test cases. First line of each test case consists of an integer n, denoting the size of array. Next line consists of n spaced integers, denoting elements of array.

OUTPUT:  Print “Yes” if it is a set of contiguous integers else print “No”.




5  2  3  6  4  4  6  6
10  14  10  12  12  13  15

Output :

Test Case 1 : The elements  of array form a contiguous set of integers which is {2, 3, 4, 5, 6} so the output is Yes.
Test Case 2: We are unable to 
form contiguous set of integers using elements of array.

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

Author: Nishant_Singh

Set Default Code

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

Compilation/Execution Result:

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