목록LeetCode (568)
넘치게 채우기
https://leetcode.com/problems/minimum-total-distance-traveled/description/?envType=daily-question&envId=2024-10-31leetcode - Minimum Total Distance Traveled문제 유형: 다이나믹 프로그래밍, 슬라이딩 윈도우문제 난이도: Hard 문제There are some robots and factories on the X-axis. You are given an integer array robot where robot[i] is the position of the ith robot. You are also given a 2D integer array factory where factory[j] ..
https://leetcode.com/problems/minimum-number-of-removals-to-make-mountain-array/description/?envType=daily-question&envId=2024-10-30leetcode - Minimum Number of Removals to Make Mountain Array문제 유형: LIS(Longest Increasing Subsequence), 다이나믹 프로그래밍문제 난이도: Hard 문제You may recall that an array arr is a mountain array if and only if:arr.length >= 3There exists some index i (0-indexed) with 0 such tha..
https://leetcode.com/problems/maximum-number-of-moves-in-a-grid/?envType=daily-question&envId=2024-10-29leetcode - Maximum Number of Moves in a Grid문제 유형: 다이나믹 프로그래밍, 재귀, dfs, 행렬문제 난이도: Medium 문제You are given a 0-indexed m x n matrix grid consisting of positive integers.You can start at any cell in the first column of the matrix, and traverse the grid in the following way:From a cell (row, col),..
https://leetcode.com/problems/longest-square-streak-in-an-array/description/?envType=daily-question&envId=2024-10-28leetcode - Longest Square Streak in an Array문제 유형: 해시, 집합, 이진 탐색, 다이나믹 프로그래밍문제 난이도: Medium 문제You are given an integer array nums. A subsequence of nums is called a square streak if:The length of the subsequence is at least 2, andafter sorting the subsequence, each element (except t..
https://leetcode.com/problems/count-square-submatrices-with-all-ones/description/?envType=daily-question&envId=2024-10-27leetcode - Count Square Submatrices with All Ones문제 유형: 다이나믹 프로그래밍, 행렬문제 난이도: Medium 문제Given a m * n matrix of ones and zeros, return how many square submatrices have all ones.m * n의 크기의 0과 1로만 이루어진 행렬이 있다. 몇 개의 1로만 이루어진 정사각형 부분행렬이 존재하는지 구하시오. 풀이우선, 1인 칸 하나하나는 각각 자신, 즉 1x1의 부분..
https://leetcode.com/problems/height-of-binary-tree-after-subtree-removal-queries/description/?envType=daily-question&envId=2024-10-26leetcode - Height of Binary Tree After Subtree Removal Queries문제 유형: 재귀, dfs, 다이나믹 프로그래밍문제 난이도: Hard 문제You are given the root of a binary tree with n nodes. Each node is assigned a unique value from 1 to n. You are also given an array queries of size m.You have to..
https://leetcode.com/problems/remove-sub-folders-from-the-filesystem/description/?envType=daily-question&envId=2024-10-25leetcode - Remove Sub-Folders from the Filesystem문제 유형: 문자열 처리, 그리디, 트라이(Trie)문제 난이도: Medium 문제Given a list of folders folder, return the folders after removing all sub-folders in those folders. You may return the answer in any order.If a folder[i] is located within another fo..
https://leetcode.com/problems/flip-equivalent-binary-trees/?envType=daily-question&envId=2024-10-24leetcode - Flip Equivalent Binary Trees문제 유형: 이진트리, bfs, dfs, 재귀문제 난이도: Medium 문제For a binary tree T, we can define a flip operation as follows: choose any node, and swap the left and right child subtrees.A binary tree X is flip equivalent to a binary tree Y if and only if we can make X equal to Y ..
https://leetcode.com/problems/cousins-in-binary-tree-ii/description/?envType=daily-question&envId=2024-10-23leetcode - Cousins in Binary Tree II문제 유형: 트리, bfs문제 난이도: Medium 문제Given the root of a binary tree, replace the value of each node in the tree with the sum of all its cousins' values.Two nodes of a binary tree are cousins if they have the same depth with different parents.Return the root o..
https://leetcode.com/problems/kth-largest-sum-in-a-binary-tree/description/?envType=daily-question&envId=2024-10-22leetcode - Kth Largest Sum in a Binary Tree문제 유형: BFS, 우선순위 큐문제 난이도: Medium 문제You are given the root of a binary tree and a positive integer k.The level sum in the tree is the sum of the values of the nodes that are on the same level.Return the kth largest level sum in the tree (not..