Given an unsorted array A of size N and value K. The elements of the array A contains positive integers. You have to print all the elements which are greater than K in the array(including K as well if present in the array A), and print all the elements which are smaller than K in seperate lines. If the elements greater than K does not present in the array then print "-1". Similarly, in case of smaller elements print -1 if elements smaller than k doesn’t exist.
First line of input contains number of testcases T. For each testcase, there are two lines, first of which contains N and K seperated by space, next line contains N space seperated integers.
For each testcase, print the required elements(if any), else print "-1" (without quotes).
Since this is a function problem, you don't need to take any input. Just complete the provided greaterKSorted and smallerKSorted functions that takes two input one is array and second is K.
1 <= T <= 100
1 <= N <= 103
1 <= K <= 106
1 <= A[i] <= 106
2 1 5 7 6
1 2 5 6 7
Testcase 1 : Since, 1, 2, 5, 6, 7 are greater or equal to given K. Also, no element less than K is present in the array.
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.