Validate binary search tree sol2 follow definition