Hi everyone,
Can someone help me with this problem.
The problem is, initially you are given an empty array A. You are given with 2 types of queries.
The first one is 1 X Y. Which means add X to the array Y times.
The second one is 2 N. Output the number at the Nth position in the array, when the array is sorted increasingly.
For example:
1 5 5
2 4
1 3 6
2 6
2 7
Array after 1st query : 5 5 5 5 5
Array after 3rd quer : 3 3 3 3 3 3 5 5 5 5 5
Then output would be: 5, 3, 5.