add solution for flatten binary tree