Python 3 & Java | Deque | Explanation
Explanation\n- Intuition is pretty much just a simulation of the process, you can totally use array operation instead of Deque. Deque seems more straight forwar
### Explanation\n- Intuition is pretty much just a simulation of the process, you can totally use array operation instead of Deque. Deque seems more straight forward to simulate the process.\n- While `n` is greater than total count of current available number (`self.q[0]`), meaning current number is not enough to exhaust `n`, thus:\n\t- `n = n - self.q[0]`, then\n\t- popleft twice to clear count & value\n- If `n` is less than or equal to total count of current available number (`self.q[0]`), meaning current number has enough count to exhaust `n`, thus:\n\t- `self.q[0] -= n`, then\n\t- No need to pop since there might be some leftover for current number\n- If `n` is exhausted, return current number (`self.q[1]`)\n- Otherwise, return `-1` (meaning we failed to exhaust `n` using `self.q`)\n### Implementation\n<iframe src="https://leetcode.com/playground/KomHCN9z/shared" frameBorder="0" width="600" height="500"></iframe>
['Queue', 'Simulation', 'Python', 'Python3']