목록다시볼문제 (129)
넘치게 채우기
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..
https://leetcode.com/problems/count-triplets-that-can-form-two-arrays-of-equal-xor/description/leetcode - Count Triplets That Can Form Two Arrays of Equal XOR문제 유형 : 부분합, 비트마스킹문제 난이도 : Medium 문제Given an array of integers arr.We want to select three indices i, j and k where (0 Let's define a and b as follows:a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]Note that..
https://leetcode.com/problems/number-of-steps-to-reduce-a-number-in-binary-representation-to-one/description/leetcode - Number of Steps to Reduce a Number in Binary Representation to One문제 유형 : 비트마스킹, 그리디문제 난이도 : Medium 문제Given the binary representation of an integer as a string s, return the number of steps to reduce it to 1 under the following rules:If the current number is even, you have to d..
https://leetcode.com/problems/word-break-ii/description/leetcode - Word Break II문제 유형 : 문자열 처리, 다이나믹 프로그래밍문제 난이도 : Hard 문제Given a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences in any order.Note that the same word in the dictionary may be reused multiple times in the segmentatio..
https://leetcode.com/problems/maximum-score-words-formed-by-letters/description/leetcode - Maximum Score Words Formed by Letters문제 유형 : 재귀, 백트래킹, dfs, 문자열 처리문제 난이도 : Hard 문제Given a list of words, list of single letters (might be repeating) and score of every character.Return the maximum score of any valid set of words formed by using the given letters (words[i] cannot be used two or more times)..