update util functions for binary tree and add solution for flatten binary tree.