목록2024/06 (30)
넘치게 채우기
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/minimum-number-of-days-to-make-m-bouquets/description/leetcode - Minimum Number of Days to Make m Bouquets문제 유형 : 이진탐색, 그리디, 슬라이딩 윈도우, 구현문제 난이도 : Medium 문제You are given an integer array bloomDay, an integer m and an integer k.You want to make m bouquets. To make a bouquet, you need to use k adjacent flowers from the garden.The garden consists of n flowers, the ith f..
https://leetcode.com/problems/most-profit-assigning-work/description/leetcode - Most Profit Assigning Work문제 유형 : 정렬, 그리디, 이진탐색문제 난이도 : Medium 문제You have n jobs and m workers. You are given three arrays: difficulty, profit, and worker where:difficulty[i] and profit[i] are the difficulty and the profit of the ith job, andworker[j] is the ability of jth worker (i.e., the jth worker can only comple..
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/ipo/description/leetcode - IPO문제 유형 : 우선순위 큐, 정렬문제 난이도 : Hard 문제Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the IPO. Since it has limited resources, it can only finish at most k distinct projects before the IPO. Help LeetCode desi..
https://leetcode.com/problems/minimum-increment-to-make-array-unique/description/leetcode - Minimum Increment to Make Array Unique문제 유형 : 정렬, 그리디문제 난이도 : Medium 문제You are given an integer array nums. In one move, you can pick an index i where 0 and increment nums[i] by 1.Return the minimum number of moves to make every value in nums unique.The test cases are generated so that the answer fits in..
https://leetcode.com/problems/minimum-number-of-moves-to-seat-everyone/description/leetcode - Minimum Number of Moves to Seat Everyone문제 유형 : 정렬, 그리디문제 난이도 : Easy 문제There are n seats and n students in a room. You are given an array seats of length n, where seats[i] is the position of the ith seat. You are also given the array students of length n, where students[j] is the position of the jth stu..
https://leetcode.com/problems/sort-colors/leetcode - Sort Colors문제 유형 : 정렬문제 난이도 : Medium 문제Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.We will use the integers 0, 1, and 2 to represent the color red, white, and blue, respectively.You must solve this problem wi..
https://leetcode.com/problems/relative-sort-array/description/leetcode - Relative Sort Array문제 유형 : 정렬, 해시문제 난이도 : Easy 문제Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that do not appear in arr2 should be placed at the end of ..