From 0728b48e7debde1b68a49fd19aca058d1dd323e2 Mon Sep 17 00:00:00 2001 From: Deven <63876261+devenperez@users.noreply.github.com> Date: Wed, 18 Jan 2023 22:30:27 -0500 Subject: [PATCH] Create README - LeetHub --- .../README.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 1028-recover-a-tree-from-preorder-traversal/README.md diff --git a/1028-recover-a-tree-from-preorder-traversal/README.md b/1028-recover-a-tree-from-preorder-traversal/README.md new file mode 100644 index 0000000..014e494 --- /dev/null +++ b/1028-recover-a-tree-from-preorder-traversal/README.md @@ -0,0 +1,35 @@ +
We run a preorder depth-first search (DFS) on the root of a binary tree.
At each node in this traversal, we output D dashes (where D is the depth of this node), then we output the value of this node. If the depth of a node is D, the depth of its immediate child is D + 1. The depth of the root node is 0.
If a node has only one child, that child is guaranteed to be the left child.
+ +Given the output traversal of this traversal, recover the tree and return its root.
+
Example 1:
+
+Input: traversal = "1-2--3--4-5--6--7" +Output: [1,2,5,3,4,6,7] ++ +
Example 2:
+
+Input: traversal = "1-2--3---4-5--6---7" +Output: [1,2,5,3,null,6,null,4,null,7] ++ +
Example 3:
+
+Input: traversal = "1-401--349---90--88" +Output: [1,401,null,349,88,90] ++ +
+
Constraints:
+ +[1, 1000].1 <= Node.val <= 109