Pregunta de entrevista de FiscalNote

Write a function to traverse a binary tree in sorted order.

Respuestas de entrevistas

Anónimo

19 feb 2026

function inOrderTraversal(root) { const stack = []; const result = []; let current = root; while (stack.length > 0 || current) { while (current) { stack.push(current); current = current.left; } current = stack.pop(); result.push(current.value); current = current.right; } return result; }

Anónimo

2 dic 2015

I wrote a standard response on whiteboard.