본문 바로가기
반응형

🖥️ 문제 풀이111

[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.
[LeetCode 해석 및 풀이] 3.Longest Substring Without Repeating Characters LeetCode 문제 해석 및 풀이 방법 문제 3.Longest Substring Without Repeating Characters(반복되는 글자 없는 가장 긴 부분 문자열)바로가기 문제 설명영문Given a string s, find the length of the longest substring without repeating characters.한글문자열 s가 주어졌을 때, 반복되는 글자가 없는 가장 긴 부문 문자열의 길이를 구하시오 제한조건0 s consists of English letters, digits, symbols and spaces. 입출력 예입력출력"abcabcbb"3"bbbbb"1"pwwkew"3  해답 및 해설파이썬 (Python)neetcode 로드맵에 나온 대로 슬라이딩 윈.. 2024. 5. 7.
[LeetCode 해석 및 풀이] 271. String Encode and Decode LeetCode 문제 해석 및 풀이 방법 문제 271. String Encode and Decode(문자열을 인코드, 디코드하기 )바로가기 무료버전 바로가기문제 설명영문Design an algorithm to encode a list of strings to a single string. The encoded string is then decoded back to the original list of strings. Please implement encode and decode한글리스트의 문자열을 하나의 문자열로 인코드하는 알고리즘을 작성하시오. 그런 다음 인코딩된 문자열은 원래 문자열 목록으로 다시 디코딩됩니다. encode와 decode를 구현하십시오. 제한조건0 0 strs[i] contains o.. 2024. 5. 6.
반응형