Today, I was called for interview in Sopra Steria. Approximate 100 persons were present during the interview process. First round as technical test which consists of 2 complex questions from hackersearth websites. Though I failed in first round itself. One question I tries to solve and I solved that 80% but could not make to 2nd round. Question which I attempted is given below along with solution so that you can post and anybody can get help.
Q. 1 You have to take input from input device with the below sysntax :
Line 1 : T No of test cases to be checked.
Line 2 : Array Count.
Line 3 : No of elements of the array.
Line 4 : Kth largest element to be found. If not found return -1.
Line 2, 3 and 4 will get repeated accordingly what we have entered in line 1.
Rule : We need to find the differences of ant 2 numbers, if it is not present then we should add this to given array. So we would have all numbers difference present in array in last.
For Example : INPUT :
1
5
1 3 5 6 7
2
1
1
2
Input : Line 1 is : we want to pass 2 test cases.
Line 2 : Array size of First Array.
Line 3 : Array Elements separated by SPACE
Line 4 : Need to find out 2nd Largest elements.
Line 5 : Array Size of Second array for test case 2.
Line 6 : Array Elements
Line 7 : 2nd largest elements to be found
Output :
6
-1
Solutions :