Algorithm · Google · Hard
Substring in Leaf Concatenation Medium · Topics: Binary Tree, String Matching, Tree Traversal · Company Tags · Hints Consider a binary tree where each leaf node stores a single character (spaces allowed) and internal nodes carry no value. Traverse the leaves from left to right, appending their characters, to produce a string S. You are given a string pattern. Decide whether pattern appears as a contiguous substring of S. Return true if it does, otherwise false. The tree is…
Checking your access…