목록그리디 (88)
넘치게 채우기
https://leetcode.com/problems/append-characters-to-string-to-make-subsequence/description/leetcode - Append Characters to String to Make Subsequence문제 유형 : 문자열처리, 그리디문제 난이도 : Medium문제 You are given two strings s and t consisting of only lowercase English letters.Return the minimum number of characters that need to be appended to the end of s so that t becomes a subsequence of s.A subsequence is ..
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/score-after-flipping-matrix/description/leetcode - Score After Flipping Matrix문제 유형 : 행렬, 비트마스킹, 그리디문제 난이도 : Medium 문제You are given an m x n binary matrix grid.A move consists of choosing any row or column and toggling each value in that row or column (i.e., changing all 0's to 1's, and all 1's to 0's).Every row of the matrix is interpreted as a binary number, and t..
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/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..
https://leetcode.com/problems/custom-sort-string/description/ Leetcode - Custom Sort String 문제 유형 : 문자열 처리, 정렬, 그리디 문제 난이도 : Medium 문제 You are given two strings order and s. All the characters of order are unique and were sorted in some custom order previously. Permute the characters of s so that they match the order that order was sorted. More specifically, if a character x occurs before a char..
https://leetcode.com/problems/intersection-of-two-arrays/description/ Leetcode - Intersection of Two Arrays 문제 유형 : 해시, 그리디 문제 난이도 : Easy 문제 Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any order. 두 정수배열 nums1과 nums2가 주어진다. 교차점을 반환하시오. 결과의 각 요소는 값이 겹치면 안되고, 순서는 상관없습니다. 풀이 해시맵에 nums1의 요소..