LeetCode

    LeetCode / Graph / 994번 / Rotting Oranges / JS

    Rotting Oranges - LeetCode Can you solve this real interview question? Rotting Oranges - You are given an m x n grid where each cell can have one of three values: * 0 representing an empty cell, * 1 representing a fresh orange, or * 2 representing a rotten orange. Every minute, any leetcode.com m * n의 격자판이 주어지는데 다음과 같은 각 셀은 3가지 상태중 하나를 가진다 0: 빈 셀 1: 신선한 오렌지가 있는 셀 2: 썩은 오렌..

    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 / 33번 / Search in Rotated Sorted Array / JS

    Search in Rotated Sorted Array - LeetCode Can you solve this real interview question? Search in Rotated Sorted Array - There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 정렬된 배열이 원형큐처럼 몇번 회전이 되었을지 알 수 없는 배열에서 target 값을 찾는 문제이다. /** * @param {number[]} nums * @p..

    LeetCode / Binary Search / 74번 / Search a 2D Matrix / JS

    Search a 2D Matrix - LeetCode Can you solve this real interview question? Search a 2D Matrix - You are given an m x n integer matrix matrix with the following two properties: * Each row is sorted in non-decreasing order. * The first integer of each row is greater than the last integer leetcode.com 주어진 2차원 배열에서 target 값이 존재하는지 찾는 문제이다. 그냥 간단히 할 수도 있겠지만... topic이 Binary Sea..