A tiny bit simpler solution

The trick is not checking for leaves but checking for the Nones after the leaves, which also handles the case of root == None.

def find_path(node, seq, i=0):
  if node is None:
    return len(seq) == i

  if i >= len(seq) or node.val != seq[i]:
    return False

  return find_path(node.left, seq, i+1) or find_path(node.right, seq, i+1)
1 Like

Hi @Guy_Rauscher,

Yes, this solution also works and indeed shorter. Please keeping updating us. Thanks.