목록2024/06 (30)
넘치게 채우기
https://leetcode.com/problems/remove-max-number-of-edges-to-keep-graph-fully-traversable/description/leetcode - Remove Max Number of Edes to Keep Graph Fully Traversable문제 유형 : 유니온-파인드, 그리디문제 난이도 : Hard 문제Alice and Bob have an undirected graph of n nodes and three types of edges:Type 1: Can be traversed by Alice only.Type 2: Can be traversed by Bob only.Type 3: Can be traversed by both Alice and..
https://leetcode.com/problems/all-ancestors-of-a-node-in-a-directed-acyclic-graph/description/leetcode - All Ancestros of a Node in a Directed Acyclic Graph문제 유형 : 위상 정렬문제 난이도 : Medium 문제You are given a positive integer n representing the number of nodes of a Directed Acyclic Graph (DAG). The nodes are numbered from 0 to n - 1 (inclusive).You are also given a 2D integer array edges, where edges[..
https://leetcode.com/problems/maximum-total-importance-of-roads/description/leetcode - Maximum Total Importance of Roads문제 유형 : 그리디, 우선순위 큐, 그래프문제 난이도 : Medium 문제You are given an integer n denoting the number of cities in a country. The cities are numbered from 0 to n - 1.You are also given a 2D integer array roads where roads[i] = [ai, bi] denotes that there exists a bidirectional road connecti..
https://leetcode.com/problems/find-center-of-star-graph/description/leetcode - Find Center of Star Graph문제 유형 : 그래프, 해시문제 난이도 : Easy 문제There is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n - 1 edges that connect the center node with every other node.You are given a 2D integer array edges where each edges[..
https://leetcode.com/problems/balance-a-binary-search-tree/description/leetcode - Balance a Binary Search Tree문제 유형 : 트리, 재귀, 이진트리, 이진탐색트리문제 난이도 : Medium 문제Given the root of a binary search tree, return a balanced binary search tree with the same node values. If there is more than one answer, return any of them.A binary search tree is balanced if the depth of the two subtrees of every node never..
https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree/description/leetcode - Binary Search Tree to Greater Sum Tree문제 유형 : 이진트리, 이진탐색트리, dfs문제 난이도 : Medium 문제Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST.As a reminder, a ..
https://leetcode.com/problems/minimum-number-of-k-consecutive-bit-flips/description/leetcode - Minimum Number of K Consecutive Bit Flips문제 유형 : 그리디 / 비트마스킹 / 슬라이딩 윈도우문제 난이도 : Hard 문제You are given a binary array nums and an integer k.A k-bit flip is choosing a subarray of length k from nums and simultaneously changing every 0 in the subarray to 1, and every 1 in the subarray to 0.Return the minim..
https://leetcode.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/description/leetcode - Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit문제 유형 : 슬라이딩 윈도우, 투 포인터, 데크(deque)문제 난이도 : Medium 문제Given an array of integers nums and an integer limit, return the size of the longest non-empty subarray such that the absolute difference betwee..
https://leetcode.com/problems/count-number-of-nice-subarrays/description/leetcode - Count Number of Nice Subarrays문제 유형 : 슬라이딩 윈도우, 투포인터문제 난이도 : Medium 문제Given an array of integers nums and an integer k. A continuous subarray is called nice if there are k odd numbers on it.Return the number of nice sub-arrays. 정수배열 nums와 정수 k가 주어집니다. 연속적인 부분배열의 요소에 홀수의 요소가 정확히 k개 있으면, nice한 subarray입니다.nice한 sub..
https://leetcode.com/problems/grumpy-bookstore-owner/description/leetcode - Grumpy Bookstore Owner문제 유형 : 슬라이딩 윈도우문제 난이도 : Medium 문제There is a bookstore owner that has a store open for n minutes. Every minute, some number of customers enter the store. You are given an integer array customers of length n where customers[i] is the number of the customer that enters the store at the start of the it..