Given an array of N positive integers, print out the missing elements (if any) in the range 0 to max of Ai. If
there are more than one missing, collate them using hyphen ( - ).
Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains a positive integer N, denoting the length of the array. The second line of each test case contains N space separated positive integers.
Output
Print out the range of missing numbers. If no element is missing, print "-1" (without quotes).
Constraints
1 <= T <= 100
0 < N <= 10000000
0 <= Ai < 10000000
Examples:
Input
3
5
62 8 34 5 332
4
13 0 32 500
5
2 0 9 15 999
Output
0-4 6-7 9-33 35-61 63-331
1-12 14-31 33-499
1 3-8 10-14 16-998
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.
bruceewayne | 192 |
manvirag982 | 178 |
theAwesome | 168 |
shivam123ahuja | 167 |
Core_Ka_Bachha | 160 |
mr_kksparrow | 433 |
manvirag982 | 394 |
TheHandle | 282 |
rajupraaa1234 | 276 |
Exception_404 | 268 |
blackshadows | 5331 |
Ibrahim Nash | 5219 |
akhayrutdinov | 5111 |
mb1973 | 4929 |
Quandray | 4567 |