Tap here to switch tabs
Problem
Submissions

Problem: Linked List in Binary Tree

Try to solve the Linked List in Binary Tree problem.

Statement

Given the head of a linked list and the root of a binary tree, determine whether there exists a downward path in the binary tree corresponding to the sequence of values in the linked list.

A downward path starts at any node in the tree and travels continuously downwards to child nodes. Return true if such a path exists that contains all values of the linked list starting from head in consecutive order, and false otherwise.

Constraints:

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

  • The number of nodes in the linked list is in the range [1,100][1, 100].

  • 1≤1 \leq Node.val ≤100\leq 100 for every node in the linked list and binary tree.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Linked List in Binary Tree

Try to solve the Linked List in Binary Tree problem.

Statement

Given the head of a linked list and the root of a binary tree, determine whether there exists a downward path in the binary tree corresponding to the sequence of values in the linked list.

A downward path starts at any node in the tree and travels continuously downwards to child nodes. Return true if such a path exists that contains all values of the linked list starting from head in consecutive order, and false otherwise.

Constraints:

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

  • The number of nodes in the linked list is in the range [1,100][1, 100].

  • 1≤1 \leq Node.val ≤100\leq 100 for every node in the linked list and binary tree.