implement the preetydraw snippets from leetcode for demonstration.
Executing the program....
$demo
Balanced tree in array format a1: 0----------6 3 1 0 2 5 4 6 Tree pretty print with level=1 and indentSpace=0 ___3__ / \ _1 _5 / \ / \ 0 2 4 6 a2: 0----------2 1 0 2 Tree pretty print with level=1 and indentSpace=0 _1 / \ 0 2
So we can easily verify that a2 is a subtree of a1.