tree

    9/13 (수) BFS를 이용한 한 문제 풀이와 바뀐 LeetCode 레이아웃 TIL

    공부한 것LeetCode #199. Binary Tree Right Side ViewLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/binary-tree-right-side-view/=> 주어진 이진 트리를 오른쪽으로 뉘여서 보았을 때 가장 윗면에 노출되는 노드를 root쪽부터 순서대로 배열에 담아서 반환하는 문제다. = 주어진 트리..

    9/12 (화) 재귀를 스스로 풀다 TIL

    공부한 것LeetCode #1448. Count Good Nodes in Binary TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/count-good-nodes-in-binary-tree/⇒ 어제에 이어서 스스로 풀어본 해답이 통했다! (스택을 이용한 해답은 다른 사람들의 해답을 참고함.) 재귀를 이용한 DFS도, 스택을 ..

    9/11 (월) 트리 심화 TIL

    공부한 것LeetCode #1448. Count Good Nodes in Binary TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/count-good-nodes-in-binary-tree/ Uploaded by N2T

    9/8 (금) 이진 탐색 트리(BST)인지 검증하라 TIL

    공부한 것LeetCode #98. Validate Binary Search TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/validate-binary-search-tree/description/재귀함수가 이렇게 간단한 형태가 될 수도 있다: function isValidBST(root: TreeNode | null, min ..

    9/7 (목) 이진 탐색 트리(BST)의 특징을 이용한 문제 TIL

    공부한 것LeetCode #235. Lowest Common Ancestor of a Binary Search TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/BST는 부모 노드의 값이 왼쪽 서브트리에 있는 모든 노드의 값..

    9/6 (수) 계속하여 재귀함수 TIL

    공부한 것LeetCode #543. Diameter of Binary TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/diameter-of-binary-tree/description/트리의 최대 깊이를 구하는 문제에 살짝 변주를 준 문제였다. Uploaded by N2T

    9/1 (금) 트리 문제 기초 접근법을 3가지로 정리하다 TIL

    공부한 것LeetCode #226. Invert Binary TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/invert-binary-tree/description/트리를 뒤집어 반환하는 문제이다. 각 노드별로 좌우 자식을 바꿔주면 되고 이는 결국 노드를 전부 방문해야 한다는 얘기가 된다. 기초적인 전위 순회(Preorder ..

    8/31 (목) 트리 순회 3형제는 깊이 우선 탐색(DFS)의 일종이다 TIL

    공부한 것LeetCode #572. Subtree of Another TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/subtree-of-another-tree/description/처음 생각해낸 방법이 대부분의 사람들이 채택한 로직임을 알게 되어서 뿌듯했다. DFS와 BFS에 대하여: 트리나 그래프와 같은 자료구조에서 노드를..

    8/30 (수) 깊이 우선 탐색(DFS) 예제 코드TIL

    공부한 것LeetCode #110. Balanced Binary TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/balanced-binary-tree/description/이상한 테스트 케이스 하나가 있는 것으로 결론 내리고 마무리 지었다. 배운 것깊이 우선 탐색(DFS)에 해당하는 예제와 생각 과정은 다음과 같다: 로직: 1..

    8/29 (화) Tree의 깊이 탐색하기 TIL

    공부한 것LeetCode #110. Balanced Binary TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/balanced-binary-tree/description/아직 타파중. 재귀 호출을 이용한 해답을 공부하고 추가하였다. 배운 것Tree 자료구조에서 한 노드를 타겟으로 그 ‘깊이’를 구하고자 할 때 공식처럼 사용할..

    8/28 (월) 너비 우선 탐색(BFS)과 새로운 메소드 TIL

    공부한 것LeetCode #100. Same TreeLeetCode - The World's Leading Online Programming Learning PlatformLevel up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.https://leetcode.com/problems/same-tree/Tree 카테고리로 넘어왔다. 기본적으로 재귀 호출이 필요한 구조인 듯 하다. LeetCode #110. Balanced Binary TreeLeetCode - The World's Leading Online Prog..