Google·Software Engineer·Onsite - Coding / Algorithms
- Given a valid boolean expression tree with AND, OR, and XOR internal nodes and boolean leaves, flip each leaf one at a time from left to right and return the root's evaluated value after each temporary flip.
“Brute force came to me pretty fast: inorder traversal to collect leaves, flip one, re-evaluate the whole tree, restore it, repeat.”