Algorithm question: determine whether binary tree B is a substructure of binary tree A. Describe your approach first, then implement it.
Asked in the round 1 coding stage.
Represent each tree as [value, left, right], where a missing child is null. Implement is_substructure(a, b) and return true if B matches a connected pattern in A. A pattern may end before A does, but every node in B must match in value and position. An empty B is not a substructure.
def is_substructure(a, b):