23 / 26
read the snippet · pick its Big-O
function walkComments(root) {const queue = [root];const out = [];let head = 0;while (head < queue.length) {const node = queue[head++];out.push(node.text);for (const child of node.replies) queue.push(child);}return out;}