leetcode (11) 썸네일형 리스트형 [Leetcode 2516번 문제] 2516. Take K of Each Character From Left and Right 문제 상황You are given a string s consisting of the characters 'a', 'b', and 'c' and a non-negative integer k. Each minute, you may take either the leftmost character of s, or the rightmost character of s.Return the minimum number of minutes needed for you to take at least k of each character, or return -1 if it is not possible to take k of each character.characters a, b, c로 이루어져있고, 음이아닌 정수 k가 있다. 매.. [Leetcode 862번 문제] 862. Shortest Subarray with Sum at Least K 문제 상황Given an integer array nums and an integer k, return the length of the shortest non-empty subarray of nums with a sum of at least k. If there is no such subarray, return -1.A subarray is a contiguous part of an array.nums와 k가 주어진다. 가장 작은 길이의 비어있지 않은 subarray를 내라. 그 subarray는 합이 k다. 없으면 -1을 리턴해라.입력1 105 1 출력과정순서가 유지되는 subarray를 리턴해야하고 input값은 음수를 끼고있는 배열,음수는 정렬의 적이다. 원래같으면 그냥 바로 누적값으로 정렬할 수 .. [Leetcode 3254번 문제] 3254. Find the Power of K-Size Subarrays I. 문제 상황You are given an array of integers nums of length n and a positive integer k.The power of an array is defined as:Its maximum element if all of its elements are consecutive and sorted in ascending order.1 otherwise.You need to find the power of all subarrays of nums of size k.Return an integer array results of size n - k + 1, where results[i] is the power of nums[i..(i + k - 1)].i 번째부터 i + k.. [Leetcode 2955번 문제] 2955. Number of Same-End Substrings 문제 상황You are given a 0-indexed string s, and a 2D array of integers queries, where queries[i] = [li, ri] indicates a substring of s starting from the index li and ending at the index ri (both inclusive), i.e. s[li..ri].각각의 쿼리가 subarrayReturn an array ans where ans[i] is the number of same-end substrings of queries[i].same-end?A 0-indexed string t of length n is called same-end if it has the same.. [Leetcode 2064번 문제] 2064. Minimized Maximum of Products Distributed to Any Store 문제 상황You are given an integer n indicating there are n specialty retail stores. There are m product types of varying amounts, which are given as a 0-indexed integer array quantities, where quantities[i] represents the number of products of the ith product type.You need to distribute all products to the retail stores following these rules:A store can only be given at most one product type but can.. [Leetcode 465번 문제] 465. Optimal Account Balancing 문제 상황You are given an array of transactions transactions where transactions[i] = [fromi, toi, amounti] indicates that the person with ID = fromi gave amounti $ to the person with ID = toi.Return the minimum number of transactions required to settle the debt.transactions 배열이 주어진다 각 요소는 a부터, b까지 c만큼 라는 뜻, a, b 는 ID고 c는 달러다.debt를 내지 않기 위해서 필요한 가장 작은 transaction의 수를 구하여라Input: transactions = [[0,1,1.. [Leetcode 2601번 문제] 2601. Prime Subtraction Operation 문제 상황You are given a 0-indexed integer array nums of length n.You can perform the following operation as many times as you want:Pick an index i that you haven’t picked before, and pick a prime p strictly less than nums[i], then subtract p from nums[i].Return true if you can make nums a strictly increasing array using the above operation and false otherwise.A strictly increasing array is an array.. [Leetcode 2955번 문제]2955. Number of Same-End Substrings 문제 상황You are given a 0-indexed string s, and a 2D array of integers queries, where queries[i] = [li, ri] indicates a substring of s starting from the index li and ending at the index ri (both inclusive), i.e. s[li..ri].각각의 쿼리가 subarrayReturn an array ans where ans[i] is the number of same-end substrings of queries[i].same-end?A 0-indexed string t of length n is called same-end if it has the same.. 이전 1 2 다음