Solve the recover tree problem in leetcode, forget to reset the class variable during each run of the function.