목록정렬 (59)
넘치게 채우기
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 ..
https://leetcode.com/problems/height-checker/description/leetcode - Height Checker문제 유형 : 정렬문제 난이도 : Easy 문제A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer array expected where expected[i] is the expected height of the ith student in line.You ar..
https://leetcode.com/problems/minimum-cost-to-hire-k-workers/description/leetcode - Minimum Cost to Hire K Workers문제 유형 : 우선순위 큐, 정렬문제 난이도 : Hard 문제There are n workers. You are given two integer arrays quality and wage where quality[i] is the quality of the ith worker and wage[i] is the minimum wage expectation for the ith worker.We want to hire exactly k workers to form a paid group. To hire a ..
https://leetcode.com/problems/maximize-happiness-of-selected-children/description/leetcode - Maximize Happiness of Selected Children문제 유형 : 정렬 / 그리디문제 난이도 : Medium 문제You are given an array happiness of length n, and a positive integer k.There are n children standing in a queue, where the ith child has happiness value happiness[i]. You want to select k children from these n children in k turns.In..
https://leetcode.com/problems/boats-to-save-people/description/leetcode - Boats to Save People문제 유형 : 정렬, 그리디, 투 포인터문제 난이도 : Medium 문제You are given an array people where people[i] is the weight of the ith person, and an infinite number of boats where each boat can carry a maximum weight of limit. Each boat carries at most two people at the same time, provided the sum of the weight of those peopl..
https://leetcode.com/problems/largest-positive-integer-that-exists-with-its-negative/description/leetcode - Largest Positive Integer That Exists With Its Negative문제 유형 : 정렬, 구현, 그리디, 투포인터문제 난이도 : Easy 문제Given an integer array nums that does not contain any zeros, find the largest positive integer k such that -k also exists in the array.Return the positive integer k. If there is no such integer, ..
https://leetcode.com/problems/first-missing-positive/description/ Leetcode - First Missing Positive 문제 유형 : 배열, 정렬 문제 난이도 : Hard 문제 Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums. You must implement an algorithm that runs in O(n) time and uses O(1) auxiliary space. 정렬되지 않은 정수 배열 nums가 주어집니다. nums에 없는 가장 작은 자연수를 반환하시오. 알고리즘을 O(n)의 시간과 O(1)의 ..
https://leetcode.com/problems/task-scheduler/description/ Leetcode - Task Scheduler 문제 유형 : 그리디, 정렬 문제 난이도 : Medium 문제 You are given an array of CPU tasks, each represented by letters A to Z, and a cooling time, n. Each cycle or interval allows the completion of one task. Tasks can be completed in any order, but there's a constraint: identical tasks must be separated by at least n intervals due ..
https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/description/ Leetcode - Minimum Number of Arrows to Burst Balloons 문제 유형 : 그리디, 정렬 문제 난이도 : Medium 문제 There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [xstart, xend] denotes a balloon whose horizontal diameter s..