We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c781aa commit 53a0254Copy full SHA for 53a0254
solution/0100-0199/0117.Populating Next Right Pointers in Each Node II/README_EN.md
@@ -146,20 +146,20 @@ class Solution {
146
return root;
147
}
148
Deque<Node> q = new ArrayDeque<>();
149
- q.offer(root);
+ q.offerLast(root);
150
while (!q.isEmpty()) {
151
Node p = null;
152
for (int n = q.size(); n > 0; --n) {
153
- Node node = q.poll();
+ Node node = q.pollFirst();
154
if (p != null) {
155
p.next = node;
156
157
p = node;
158
if (node.left != null) {
159
- q.offer(node.left);
+ q.offerLast(node.left);
160
161
if (node.right != null) {
162
- q.offer(node.right);
+ q.offerLast(node.right);
163
164
165
0 commit comments