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 027a40b commit 2c781aaCopy full SHA for 2c781aa
solution/0100-0199/0117.Populating Next Right Pointers in Each Node II/README.md
@@ -148,20 +148,20 @@ class Solution {
148
return root;
149
}
150
Deque<Node> q = new ArrayDeque<>();
151
- q.offer(root);
+ q.offerLast(root);
152
while (!q.isEmpty()) {
153
Node p = null;
154
for (int n = q.size(); n > 0; --n) {
155
- Node node = q.poll();
+ Node node = q.pollFirst();
156
if (p != null) {
157
p.next = node;
158
159
p = node;
160
if (node.left != null) {
161
- q.offer(node.left);
+ q.offerLast(node.left);
162
163
if (node.right != null) {
164
- q.offer(node.right);
+ q.offerLast(node.right);
165
166
167
0 commit comments