All challenges

Algorithm challenge · DSA

Invert Binary Tree

Difficulty

easy

Time

~15m

Format

Single

Grading

Auto-graded

#python#javascript#typescript#go#java#cpp#rust#dsa#trees#recursion
Mission file // read carefullyeasy

Invert a binary tree (represented as level-order array list). Swap left and right subtrees at each node.

[4, 2, 7]  =>  [4, 7, 2]

Build with

invertTree(tree: int[]) → int[]
PythonJavaScriptTypeScriptGoJavaC++Rust
2 tests
Auto-graded on submit
Start challenge

Sign in to save your progress.