add the solution of valid binary search tree problem in leetcode and refactor code