LeetCode/주제별 보충 67

Tree: 124. Binary Tree Maximum Path Sum

124. Binary Tree Maximum Path Sum 문제가 요구하는 것Binary Tree Maximum Path Sum:트리에서 경로의 최대 합을 구하는 문제입니다."경로"는 트리의 어떤 노드에서 시작하여 하위 노드를 따라가거나, 중간에서 멈출 수 있으며, 반드시 루트를 거칠 필요는 없습니다.경로의 합은 경로에 있는 노드 값들의 합으로 계산됩니다."최대 합"은 가능한 경로들 중 가장 큰 합입니다.Mutable(변경 가능) 객체 와 Immutable(변경 불가능) 객체파이썬에서 mutable(변경 가능) 객체와 immutable(변경 불가능) 객체는 객체의 성질에 따라 구분됩니다. 아래는 각각의 주요 예시를 정리한 표입니다.1. Mutable(변경 가능) 객체특징:객체를 생성한 후 내부 데이터를..

105. Construct Binary Tree from Preorder and Inorder Traversal

105. Construct Binary Tree from Preorder and Inorder Traversal https://youtu.be/ihj4IQGZ2zc?si=xp7MO4VGo3NIKjnW class Solution: def buildTree(self, preorder: List[int], inorder: List[int]) -> Optional[TreeNode]: # 문제 접근법: # 1. Preorder 배열의 첫 번째 값은 항상 현재 서브트리의 루트 노드 값입니다. # 1. The first value in the preorder array is always the root node of the current subtree. # 2...