목록LeetCode (522)
넘치게 채우기
https://leetcode.com/problems/minimum-number-of-operations-to-move-all-balls-to-each-box/description/leetcode - Minimum Number of Operations to Move All Balls to Each Box문제 유형: 그리디, 구간합, 라인 스위핑문제 난이도: Medium 문제You have n boxes. You are given a binary string boxes of length n, where boxes[i] is '0' if the ith box is empty, and '1' if it contains one ball.In one operation, you can move one ball fr..
https://leetcode.com/problems/shifting-letters-ii/description/leetcode - Shifting Letters II문제 유형: 문자열 처리, 슬라이딩 윈도우, 라인 스위핑, 구간합문제 난이도: Medium 문제You are given a string s of lowercase English letters and a 2D integer array shifts where shifts[i] = [starti, endi, directioni]. For every i, shift the characters in s from the index starti to the index endi (inclusive) forward if directioni = 1, or sh..
https://leetcode.com/problems/number-of-ways-to-split-array/description/leetcode - Number of Ways to Split Array문제 유형: 슬라이딩 윈도우, 구간합문제 난이도: Medium 문제You are given a 0-indexed integer array nums of length n.nums contains a valid split at index i if the following are true:The sum of the first i + 1 elements is greater than or equal to the sum of the last n - i - 1 elements.There is at least one el..
https://leetcode.com/problems/count-vowel-strings-in-ranges/description/leetcode - Count Vowel Strings in Ranges문제 유형: 문자열 처리, 부분합문제 난이도: Medium 문제You are given a 0-indexed array of strings words and a 2D array of integers queries.Each query queries[i] = [li, ri] asks us to find the number of strings present in the range li to ri (both inclusive) of words that start and end with a vowel.Return a..
https://leetcode.com/problems/minimum-cost-for-tickets/description/leetcode - Minimum Cost For Tickets문제 유형: 다이나믹 프로그래밍문제 난이도: Medium 문제You have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array days. Each day is an integer from 1 to 365.Train tickets are sold in three different ways:a 1-day pass is sold for costs[0] dol..
https://leetcode.com/problems/number-of-ways-to-form-a-target-string-given-a-dictionary/description/leetcode - Number of Ways to Form a Target String Given a Dictionary문제 유형: 다이나믹 프로그래밍, 문자열 처리문제 난이도: Hard 문제You are given a list of strings of the same length words and a string target.Your task is to form target using the given words under the following rules:target should be formed from left to ..
https://leetcode.com/problems/maximum-sum-of-3-non-overlapping-subarrays/description/leetcode - Maximum Sum of 3 Non-Overlapping Subarrays문제 유형: 슬라이딩 윈도우, 부분합, 다이나믹 프로그래밍문제 난이도: Hard 문제Given an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and return them.Return the result as a list of indices representing the starting position of each int..
https://leetcode.com/problems/best-sightseeing-pair/description/leetcode - Best Sightseeing Pair문제 유형: 그리디, 다이나믹 프로그래밍문제 난이도: Medium 문제You are given an integer array values where values[i] represents the value of the ith sightseeing spot. Two sightseeing spots i and j have a distance j - i between them.The score of a pair (i values[i] + values[j] + i - j: the sum of the values of the sightseein..
https://leetcode.com/problems/target-sum/leetcode - Target Sum문제 유형: 다이나믹 프로그래밍문제 난이도: Medium 문제You are given an integer array nums and an integer target.You want to build an expression out of nums by adding one of the symbols '+' and '-' before each integer in nums and then concatenate all the integers.For example, if nums = [2, 1], you can add a '+' before 2 and a '-' before 1 and concatenate ..
https://leetcode.com/problems/find-minimum-diameter-after-merging-two-trees/description/leetcode - Find Minimum Diameter After Merging Two Trees문제 유형: 트리, bfs, 그리디문제 난이도: Hard 문제There exist two undirected trees with n and m nodes, numbered from 0 to n - 1 and from 0 to m - 1, respectively. You are given two 2D integer arrays edges1 and edges2 of lengths n - 1 and m - 1, respectively, where edges..