Actually, full code should betop = top - 1; if (top == 0) queue.poll();
so, yes. it will update the counter in queue and next time peek(), the value has been changed.
An array is an object in Java.
Design Compressed String Iterator
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.