PS

    LeetCode / Graph / 210번 / Course Schedule II / JS

    Course Schedule II - LeetCode Can you solve this real interview question? Course Schedule II - There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take leetcode.com 총 들어야할 강의의 수인 numCourses와 선행 강의의 쌍인 prerequisites가 주어진다. 예를 들어 numCourses ..

    LeetCode / Graph / 417번 / Pacific Atlantic Water Flow / JS

    Pacific Atlantic Water Flow - LeetCode Can you solve this real interview question? Pacific Atlantic Water Flow - There is an m x n rectangular island that borders both the Pacific Ocean and Atlantic Ocean. The Pacific Ocean touches the island's left and top edges, and the Atlantic Ocean touches leetcode.com 각 칸에 있는 숫자는 그 땅의 높이라고 생각하면 된다. 따라서 그 칸에 있는 물은 현재 있는 칸의 높이보다 작거나 같..

    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..