binary search tree
LeetCode / Binary Search Tree / 173번 / Binary Search Tree Iterator / JS
Binary Search Tree Iterator - LeetCode Can you solve this real interview question? Binary Search Tree Iterator - Implement the BSTIterator class that represents an iterator over the in-order traversal [https://en.wikipedia.org/wiki/Tree_traversal#In-order_(LNR)] of a binary search tree (BST): * leetcode.com 이진 탐색 트리를 전위순회를 하였을 때, 다음 노드를 반환하는 next()와 다음 노드가 존재하는지 반환하는 hasN..
LeetCode / Binary Search Tree / 230번 / Kth Smallest Element in a BST / JS
Kth Smallest Element in a BST - LeetCode Can you solve this real interview question? Kth Smallest Element in a BST - Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree. Example 1: [https://assets.leetco leetcode.com BST(Binary Search Tree) 에서 K번째로 작은 노드의 값을 반환하는 문제이다. /** * Definit..
LeetCode / Binary Search Tree / 108번 / Convert Sorted Array to Binary Search Tree / JS
Convert Sorted Array to Binary Search Tree - LeetCode Can you solve this real interview question? Convert Sorted Array to Binary Search Tree - Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree. Example 1: [https://assets.leetcod leetcode.com input으로 들어온 정렬된 배열을 이진 탐색 트리로 변환하는 문제이다. /** * Defini..
LeetCode / Binary Search Tree / 235번 / Lowest Common Ancestor of a Binary Search Tree / JS
Lowest Common Ancestor of a Binary Search Tree - LeetCode Can you solve this real interview question? Lowest Common Ancestor of a Binary Search Tree - Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According to the definition of LCA on Wikipedia [https: leetcode.com TreeNode인 p와 q가 주어지는데, p와 q의 가장 가까운 공통 부모노드를 찾..
LeetCode / Binary Search Tree / 98번 / Validate Binary Search Tree / JS
Validate Binary Search Tree - LeetCode Can you solve this real interview question? Validate Binary Search Tree - Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: * The left subtree of a node contains only nodes with keys le leetcode.com 주어진 Tree가 유효한 BST(Binary Search Tree)인지 확인해서 boolean 값을 반환하는 문제이다..