Leetcode18 2259. Remove Digit From Number to Maximize Result https://leetcode.com/problems/remove-digit-from-number-to-maximize-result/description/ Remove Digit From Number to Maximize Result - LeetCode Can you solve this real interview question? Remove Digit From Number to Maximize Result - You are given a string number representing a positive integer and a character digit. Return the resulting string after removing exactly one occurrence of digit from n.. 2023. 5. 27. 2260. Minimum Consecutive Cards to Pick Up https://leetcode.com/problems/minimum-consecutive-cards-to-pick-up/ Minimum Consecutive Cards to Pick Up - LeetCode Can you solve this real interview question? Minimum Consecutive Cards to Pick Up - You are given an integer array cards where cards[i] represents the value of the ith card. A pair of cards are matching if the cards have the same value. Return the minimum n leetcode.com 두 개의 같은 값 주 .. 2023. 5. 26. 24. Swap Nodes in Pairs - python https://leetcode.com/problems/swap-nodes-in-pairs/ Swap Nodes in Pairs - LeetCode Can you solve this real interview question? Swap Nodes in Pairs - Given a linked list, swap every two adjacent nodes and return its head. You must solve the problem without modifying the values in the list's nodes (i.e., only nodes themselves may be chan leetcode.com 노드를 순회 하면서 2개씩 리스트에 넣고 2개가 채워지면 다시 리스트에 넣어 이중 리스.. 2023. 5. 19. 1721. Swapping Nodes in a Linked List - python https://leetcode.com/problems/swapping-nodes-in-a-linked-list/ Swapping Nodes in a Linked List - LeetCode Can you solve this real interview question? Swapping Nodes in a Linked List - You are given the head of a linked list, and an integer k. Return the head of the linked list after swapping the values of the kth node from the beginning and the kth node from t leetcode.com 링크드 리스트 앞에서 k 번 원소와 뒤에.. 2023. 5. 16. 59. Spiral Matrix II - python https://leetcode.com/problems/spiral-matrix-ii/ Spiral Matrix II - LeetCode Can you solve this real interview question? Spiral Matrix II - Given a positive integer n, generate an n x n matrix filled with elements from 1 to n2 in spiral order. Example 1: [https://assets.leetcode.com/uploads/2020/11/13/spiraln.jpg] Input: n = 3 O leetcode.com 이전 나선형 문제에서 난이도 상승 이건 n이 주어지면 나선형 행렬을 반환한다 이전 문제와 같은 방법.. 2023. 5. 10. 54. Spiral Matrix - python https://leetcode.com/problems/spiral-matrix/description/ Spiral Matrix - LeetCode Can you solve this real interview question? Spiral Matrix - Given an m x n matrix, return all elements of the matrix in spiral order. Example 1: [https://assets.leetcode.com/uploads/2020/11/13/spiral1.jpg] Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Outpu leetcode.com 정처기가 생각나는 Spiral.. 행렬의 원소를 나선형으로 리스트에 담아 리턴한다 한쪽 .. 2023. 5. 9. 1572. Matrix Diagonal Sum - python https://leetcode.com/problems/matrix-diagonal-sum/description/ Matrix Diagonal Sum - LeetCode Can you solve this real interview question? Matrix Diagonal Sum - Given a square matrix mat, return the sum of the matrix diagonals. Only include the sum of all the elements on the primary diagonal and all the elements on the secondary diagonal that are leetcode.com 행렬의 대각 합을 모두 더하는데 x 형태로 더한다 같은 칸은 중복해.. 2023. 5. 8. 258. Add Digits https://leetcode.com/problems/add-digits/description/ Add Digits - LeetCode Can you solve this real interview question? Add Digits - Given an integer num, repeatedly add all its digits until the result has only one digit, and return it. Example 1: Input: num = 38 Output: 2 Explanation: The process is 38 --> 3 + 8 --> 11 11 --> leetcode.com 숫자 자릿수 합 -> 10 이상이면 다시 숫자 자릿수 합 -> 10 이상이면 다시 반복 10 보다 작.. 2023. 4. 26. 1372. Longest ZigZag Path in a Binary Tree - python https://leetcode.com/problems/longest-zigzag-path-in-a-binary-tree/description/ Longest ZigZag Path in a Binary Tree - LeetCode Can you solve this real interview question? Longest ZigZag Path in a Binary Tree - You are given the root of a binary tree. A ZigZag path for a binary tree is defined as follow: * Choose any node in the binary tree and a direction (right or left). * If the leetcode.com .. 2023. 4. 22. 946. Validate Stack Sequences - python https://leetcode.com/problems/validate-stack-sequences/ Validate Stack Sequences - LeetCode Can you solve this real interview question? Validate Stack Sequences - Given two integer arrays pushed and popped each with distinct values, return true if this could have been the result of a sequence of push and pop operations on an initially empty stack leetcode.com 스택에서 제거는 마지막 값만 할 수 있으니까 추가하는 리스트의 값.. 2023. 4. 15. 20. Valid Parentheses - python https://leetcode.com/problems/valid-parentheses/description/ Valid Parentheses - LeetCode Can you solve this real interview question? Valid Parentheses - Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the sam leetcode.com 전형적인 스택 문제 괄호 검사 한개일 경우 괄호 "(" 가 나오면 무.. 2023. 4. 11. 1020. Number of Enclaves - python https://leetcode.com/problems/number-of-enclaves/ Number of Enclaves - LeetCode Can you solve this real interview question? Number of Enclaves - You are given an m x n binary matrix grid, where 0 represents a sea cell and 1 represents a land cell. A move consists of walking from one land cell to another adjacent (4-directionally) land leetcode.com leetcode는 데일리 문제가 약간 비슷한 유형에서 나오니까 어제와 같은 bfs 문제.. 2023. 4. 7. 1254. Number of Closed Islands - python https://leetcode.com/problems/number-of-closed-islands/description/ Number of Closed Islands - LeetCode Can you solve this real interview question? Number of Closed Islands - Given a 2D grid consists of 0s (land) and 1s (water). An island is a maximal 4-directionally connected group of 0s and a closed island is an island totally (all left, top, right, leetcode.com 아마 제일 많은 거 같은 문제 유형 bfs/dfs 일단 .. 2023. 4. 6. 2405. Optimal Partition of String https://leetcode.com/problems/optimal-partition-of-string/description/ Optimal Partition of String - LeetCode Can you solve this real interview question? Optimal Partition of String - Given a string s, partition the string into one or more substrings such that the characters in each substring are unique. That is, no letter appears in a single substring more than o leetcode.com 문자열을 분할하는데 같은 문자가 .. 2023. 4. 4. 2492. Minimum Score of a Path Between Two Cities https://leetcode.com/problems/minimum-score-of-a-path-between-two-cities/ Minimum Score of a Path Between Two Cities - LeetCode Can you solve this real interview question? Minimum Score of a Path Between Two Cities - You are given a positive integer n representing n cities numbered from 1 to n. You are also given a 2D array roads where roads[i] = [ai, bi, distancei] indicates that leetcode.com 그.. 2023. 3. 22. 103. Binary Tree Zigzag Level Order Traversal(Medium) Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. (i.e., from left to right, then right to left for the next level and alternate between). root이진 트리가 주어 지면 노드 값의 지그재그 수준 순회를 반환합니다 . (즉, 왼쪽에서 오른쪽으로, 다음 레벨은 오른쪽에서 왼쪽으로 그리고 그 사이를 번갈아 가며). 이진 트리에서 한단계 내려갈때마다 왼쪽에서 오른쪽으로 출력 그 다음단계는 오른쪽에서 왼쪽으로 출력하는 문제 일단 한층씩 내려가면서 같은층 원소는 한 리스트에 넣어가면서 이중리스트를 만든다 그리고 홀수번째 리스트들.. 2023. 2. 19. 226. Invert Binary Tree (Easy) Given the root of a binary tree, invert the tree, and return its root. 이진 트리 가 주어 root지면 트리를 반전하고 루트를 반환합니다 . 주어진 이진트리 왼쪽과 오른쪽노드를 바꿔서 리턴하는 문제 매우 간단하다 한단계씩 내려가면서 왼쪽은노드는 오른쪽값으로 오른쪽 노드는 오른쪽값으로 바꿔주기만 하면 해결 # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def invertTree(s.. 2023. 2. 18. 783. Minimum Distance Between BST Nodes(Easy) Given the root of a Binary Search Tree (BST), return the minimum difference between the values of any two different nodes itn the tree. 이진 탐색 트리에서 두 개의 노드 값의 차이 중에서 가장 작은 값을 찾아내는 문제 모든 트리를 지나다니면서 리스트에 값을 모아놓고 정렬하고 반복문을 사용해 최소 차이를 찾아냄 아마 더 간단한 방법이 있을 거 같다.. # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = lef.. 2023. 2. 17. 이전 1 다음