Skip to main content

Invert Binary Tree

Invert the binary tree and return its root Example: [4,2,7,1,3,6,9] => [4,7,2,9,6,3,1]

This is really about exploring a state space without revisiting the same work. It's a great warm-up that builds traversal modeling without a ton of moving parts. Be clear about what a state is; that's the difference between BFS/DFS working or blowing up.

Meet Coco

Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Sign in free to type with Coco, up to a daily limit, and to talk with her for one hour. After that, talking comes with the $79 pack. Anyone can open the editor and run their code.

1Invert Binary Treeeasy
2Part 2
3Part 3

Each locked part opens in the editor once the part before it passes.

Get a note when something new lands

New company guides, new problems and big changes to Coco. Rare, and you can leave any time. By joining you agree to get these emails.