목록다시볼문제 (123)
넘치게 채우기
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/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/magnetic-force-between-two-balls/description/leetcode - Magnetic Force Between Two Balls문제 유형 : 이진 탐색문제 난이도 : Medium 문제In the universe Earth C-137, Rick discovered a special form of magnetic force between two balls if they are put in his new invented basket. Rick has n empty baskets, the ith basket is at position[i], Morty has m balls and needs to distribute the bal..
https://leetcode.com/problems/sum-of-square-numbers/description/leetcode - Sum of Square Numbers문제 유형 : 수학, 투포인터문제 난이도 : Medium 문제Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c. 음수가 아닌 정수 c가 주어진다. a^2+b^c = c를 만족하는 두 정수 a와 b가 있는지 확인하시오. 풀이가장 기본적으로 떠올릴 수 있는 경우는 a = 0, b = c^(1/2)이다.b가 c의 제곱근인 경우, 바로 true가 나온다. 아니라면, a*a+b*b를 sum이라 하자.sum이 c보다 크면..
https://leetcode.com/problems/patching-array/description/leetcode - Patching Array문제 유형 : 그리디문제 난이도 : Hard 문제Given a sorted integer array nums and an integer n, add/patch elements to the array such that any number in the range [1, n] inclusive can be formed by the sum of some elements in the array.Return the minimum number of patches required. 정수 배열 nums와 정수 n이 주어진다. 배열에 요소를 추가하여 닫힌구간 [1, n]의 모든..
https://leetcode.com/problems/continuous-subarray-sum/description/leetcode - Continuous Subarray Sum문제 유형 : 부분합, 수학문제 난이도 : Medium 문제Given an integer array nums and an integer k, return true if nums has a good subarray or false otherwise.A good subarray is a subarray where:its length is at least two, andthe sum of the elements of the subarray is a multiple of k.Note that:A subarray is a contiguo..
https://leetcode.com/problems/replace-words/description/leetcode - Replace Words문제 유형 : 문자열 처리, 트라이(Trie)문제 난이도 : Medium 문제In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word derivative. For example, when the root "help" is followed by the word "ful", we can form a derivative "helpful".Given a dictionary consisti..
https://leetcode.com/problems/single-number-iii/description/leetcode - Single Number III문제 유형 : 비트마스킹문제 난이도 : Medium 문제Given an integer array nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in any order.You must write an algorithm that runs in linear runtime complexity and..