refactored isValidBSTNode - simplified and reduced code size