본문 바로가기
반응형

분류 전체보기167

[LeetCode 해석 및 풀이] 543. Diameter of Binary Tree (이진 트리에서의 지름) LeetCode 문제 해석 및 풀이 방법 문제 543. Diameter of Binary Tree (이진트리에서의 지름)바로가기 문제 설명영문Given the root of a binary tree, return the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root. The length of a path between two nodes is represented by the number of edges between them. 한글이.. 2024. 7. 18.
[LeetCode 해석 및 풀이] 104. Maximum Depth of Binary Tree(이진 트리의 최대 깊이) LeetCode 문제 해석 및 풀이 방법 문제 104. Maximum Depth of Binary Tree(이진 트리의 최대 깊이)바로가기 문제 설명영문Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 한글이진 트리의 root가 주어지면, 최대 깊이를 반환하십시오. 이진 트리의 최대 깊이는 root 노트로부터 가장 멀리 있는 노드까지의 경로에 있는 노드의 갯수입니다. 제한조건The number of nodes in the tr.. 2024. 7. 4.
[LeetCode 해석 및 풀이] 226. Invert Binary Tree (이진 트리 뒤집기) LeetCode 문제 해석 및 풀이 방법 문제 226. Invert Binary Tree(이진 트리 뒤집기)바로가기 문제 설명영문Given the root of a binary tree, invert the tree, and return its root. 한글이진트리의 root가 주어지면, 트리를 뒤집고 root를 반환하십시 제한조건The number of nodes in the tree is in the range [0, 100].-100  입출력 예입력출력root = [4,2,7,1,3,6,9][4,7,2,9,6,3,1]root = [2,1,3][2,3,1]root = [][]  해답 및 해설파이썬 (Python)class Solution: def invertTree(self, root: Opt.. 2024. 7. 4.
[LeetCode 해석 및 풀이] 146. LRU Cache LeetCode 문제 해석 및 풀이 방법 문제 146. LRU Cache(LRU 캐시)바로가기 문제 설명영문Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class:LRUCache(int capacity) Initialize the LRU cache with positive size capacity.int get(int key) Return the value of the key if the key exists, otherwise return -1.void put(int key, int value) Update the value of the key i.. 2024. 6. 7.
[LeetCode 해석 및 풀이] 287. Find the Duplicate Number LeetCode 문제 해석 및 풀이 방법 문제 287. Find the Duplicate Number(반복되는 수 찾기)바로가기 문제 설명영문Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number in nums, return this repeated number. You must solve the problem without modifying the array nums and uses only constant extra space. Follow up:How can we prove that at least.. 2024. 6. 6.
[LeetCode 해석 및 풀이] 141. Linked List Cycle LeetCode 문제 해석 및 풀이 방법 문제 141. Linked List Cycle(연결 리스트 순환)바로가기 문제 설명영문Given head, the head of a linked list, determine if the linked list has a cycle in it. There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the next pointer. Internally, pos is used to denote the index of the node that tail's next pointer is connected to. Note.. 2024. 6. 5.
반응형