Tap here to switch tabs
Problem
Submissions

Problem: Binary Tree Pruning

Try to solve the Binary Tree Pruning problem.

Statement

Given the root of a binary tree, return the same tree after pruning all subtrees that do not contain a 11.

A subtree of a node node consists of node together with all of its descendants.

Constraints:

  • The number of nodes in the tree is in the range [1,200][1, 200].

  • Node.val is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Binary Tree Pruning

Try to solve the Binary Tree Pruning problem.

Statement

Given the root of a binary tree, return the same tree after pruning all subtrees that do not contain a 11.

A subtree of a node node consists of node together with all of its descendants.

Constraints:

  • The number of nodes in the tree is in the range [1,200][1, 200].

  • Node.val is either 00 or 11.