lcs modification
binary tree