Search
⌘K

Leetcode 536. Construct Binary Tree from String

Reconstruct a binary tree from its preorder string representation where node values are integers and left/right children are given as parenthesized substrings (e.g., "4(2(3)(1))(6(5))"); parse nested parentheses and multi-digit/negative numbers and attach subtrees appropriately using recursion or a stack.

Asked at:

M

MoEngage

Meta


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late April, 2026

M

MoEngage

Mid-level

Early August, 2025

Meta

Senior

You need to construct a binary tree from a string consisting of parenthesis and integers.

Late March, 2025

Meta

Senior

Your account is free and you can post anonymously if you choose.