solution for Symmetric Tree