solve path sum and flatten binary tree to linked list