We need to maintain a queue that is initially empty. We need to perform three types of operations on the queue:
- 1 X - add number X to the queue
- 2 0 - remove the least recently added number from the queue (basically from the front of the queue)
- 3 X - consider the current numbers in the queue and find the max size of a subset of numbers in the queue whose sum is X. If there is no such subset return -1.
A subset is defined as a sequence that can be obtained by removing some (possibly all) elements present in the queue.
input: a 2d array A containing the sequence of operations done on the queue.
~~~~~ Constraints-
1<=X<=350
|A|<=10^5