Leetcode Solution Python Tree Structure