JAVA_Search in a Binary Search Tree_LeetCode 700


JAVA_Search in a Binary Search Tree_LeetCode 700

JAVA_Search in a Binary Search Tree_LeetCode 700 풀이 class Solution { public TreeNode searchBST(TreeNode root, int val) { while(root != null && root.val != val) { root = (val > root.val) ? root.right : root.left; } return root; } } * 출처 Search in a Binary Search Tree - LeetCode Search in a Binary Search Tree - You are given the root of a binary search tree (BST) and an integer val. Find the node in the BST that the node's value equals val and return the subtree rooted with that node. If such a no...


#JAVA #JAVA_LeetCode700 #JAVA_SearchinaBinarySearchTree #JAVA_SearchinaBinarySearchTree_LeetCode700 #SearchinaBinarySearchTree_LeetCode700

원문링크 : JAVA_Search in a Binary Search Tree_LeetCode 700