# tree
1949. 우수 마을
시간 제한: 2초메모리 제한: 128MBNaive 하게 각 마을을 포함시키거나 빼면서 모든 경우를 조사하여 풀 수 있다. 그러나 시간 복잡도는 O(2^N)이다. 대신, xxoxA oxoxA 두 순서로 이루어진 경우가 존재할 때, 뒤에 A 순서는 중복되므로 다시 계산해

[Leetcode]1379. Find a Corresponding Node of a Binary Tree in a Clone of That Tree
Given two binary trees original and cloned and given a reference to a node target in the original tree.The cloned tree is a copy of the original tree.
2213. 트리의 독립집합
시간 제한: 2초메모리 제한: 128MBNaive 하게 풀려면, 다음과 같이 DFS를 진행하면서, 각 node를 포함시킬 때와 포함시키지 않을 때를 모두 조사하여 가능한 최대를 구하면 된다. 그러나, 이 경우 시간 복잡도는 O(2^N)이다.이때, 각 node에서의 최대

[LeetCode] #743: Network Delay Time
Return the time it takes for all the n nodes to receive the signal. If it is impossible for all the n nodes to receive the signal, return -1.
2250. 트리의 높이와 너비
시간 제한: 2초메모리 제한: 128MB먼저, 각 node의 위치를 구해야 한다. 이는 (왼쪽 자손의 수) + (현 node의 범위 왼쪽 끝)으로 구할 수 있다. In-Order DFS를 이용하면 된다.(l, .., ) 구간에 존재할 수 있는 현재 node의 위치를 다
Study plan
Understanding the algorithm and structure of map, array, list, and tree. Let's digging them.Life cycle of React and React NativeFunctional Programming

[LeetCode] #103: Binary Tree Zigzag Level Order Traversal
Given the root of a binary tree, return the zigzag level order traversal of its nodes' values.

[LeetCode] #102: Binary Tree Level Order Traversal
Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).

[LeetCode] #112: Path Sum
Return true if the tree has a root-to-leaf path such that adding up all the values along the path equals targetSum.

[LeetCode] #108: Convert Sorted Array to Binary Search Tree
Problem: Given an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.

[LeetCode] #111: Minimum Depth of Binary Tree
Given a binary tree, find its minimum depth.

[알고리즘] Java / 백준 / 트리의 순회 / 2263
문제문제 링크n개의 정점을 갖는 이진 트리의 정점에 1부터 n까지의 번호가 중복 없이 매겨져 있다. 이와 같은 이진 트리의 인오더와 포스트오더가 주어졌을 때, 프리오더를 구하는 프로그램을 작성하시오.접근 방식인오더와 포스트오더, 그리고 프리오더의 관계를 알면 풀 수 있
[baekjoon] #1949: 우수 마을
problem linkIf i(th) village is excellent village, the adjacent village (child villages) must not be excellent village.If i(th) village is not excelle
5639. 이진 검색 트리
문제 시간 제한: 1초 메모리 제한: 256MB Problem Analysis 어떤 순서로 출력하든 간에, 당연히 tree를 갖고 있어야 한다. 이때, 예를들어, 한 node의 값이 30이고 구간이 [20, 50]이라면, right-subtree는 구간이 [31,

[LeetCode] #617: Merge Two Binary Trees
You are given two binary trees root1 and root2. Return the merged tree.