Skip to content

776. Split BST#53

Open
hayashi-ay wants to merge 3 commits intomainfrom
hayashi-ay-patch-42
Open

776. Split BST#53
hayashi-ay wants to merge 3 commits intomainfrom
hayashi-ay-patch-42

Conversation

@hayashi-ay
Copy link
Copy Markdown
Owner

https://leetcode.com/problems/split-bst/description/

Given the root of a binary search tree (BST) and an integer target, split the tree into two subtrees where one subtree has nodes that are all smaller or equal to the target value, while the other subtree has all nodes that are greater than the target value. It Is not necessarily the case that the tree contains a node with the value target.

Additionally, most of the structure of the original tree should remain. Formally, for any child c with parent p in the original tree, if they are both in the same subtree after the split, then node c should still have the parent p.

Return an array of the two roots of the two subtrees.

@nodchip
Copy link
Copy Markdown

nodchip commented Mar 18, 2024

よいと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants