Skip to content

Commit fa6c91b

Browse files
Added README.md file for Linked List in Binary Tree
1 parent 96e1c78 commit fa6c91b

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

linked-list-in-binary-tree/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<h2><a href="https://leetcode.com/problems/linked-list-in-binary-tree">Linked List in Binary Tree</a></h2> <img src='https://img.shields.io/badge/Difficulty-Medium-orange' alt='Difficulty: Medium' /><hr><p>Given a binary tree <code>root</code> and a&nbsp;linked list with&nbsp;<code>head</code>&nbsp;as the first node.&nbsp;</p>
2+
3+
<p>Return True if all the elements in the linked list starting from the <code>head</code> correspond to some <em>downward path</em> connected in the binary tree&nbsp;otherwise return False.</p>
4+
5+
<p>In this context downward path means a path that starts at some node and goes downwards.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2020/02/12/sample_1_1720.png" style="width: 220px; height: 280px;" /></strong></p>
11+
12+
<pre>
13+
<strong>Input:</strong> head = [4,2,8], root = [1,4,4,null,2,2,null,1,null,6,8,null,null,null,null,1,3]
14+
<strong>Output:</strong> true
15+
<strong>Explanation:</strong> Nodes in blue form a subpath in the binary Tree.
16+
</pre>
17+
18+
<p><strong class="example">Example 2:</strong></p>
19+
20+
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2020/02/12/sample_2_1720.png" style="width: 220px; height: 280px;" /></strong></p>
21+
22+
<pre>
23+
<strong>Input:</strong> head = [1,4,2,6], root = [1,4,4,null,2,2,null,1,null,6,8,null,null,null,null,1,3]
24+
<strong>Output:</strong> true
25+
</pre>
26+
27+
<p><strong class="example">Example 3:</strong></p>
28+
29+
<pre>
30+
<strong>Input:</strong> head = [1,4,2,6,8], root = [1,4,4,null,2,2,null,1,null,6,8,null,null,null,null,1,3]
31+
<strong>Output:</strong> false
32+
<strong>Explanation:</strong> There is no path in the binary tree that contains all the elements of the linked list from <code>head</code>.
33+
</pre>
34+
35+
<p>&nbsp;</p>
36+
<p><strong>Constraints:</strong></p>
37+
38+
<ul>
39+
<li>The number of nodes in the tree will be in the range <code>[1, 2500]</code>.</li>
40+
<li>The number of nodes in the list will be in the range <code>[1, 100]</code>.</li>
41+
<li><code>1 &lt;= Node.val&nbsp;&lt;= 100</code>&nbsp;for each node in the linked list and binary tree.</li>
42+
</ul>

0 commit comments

Comments
 (0)