목록슬라이딩 윈도우 (26)
넘치게 채우기
https://leetcode.com/problems/maximum-ascending-subarray-sum/description/leetcode - Maximum Ascending Subarray Sum문제 유형: 슬라이딩 윈도우문제 난이도: Easy 문제Given an array of positive integers nums, return the maximum possible sum of an ascending subarray in nums.A subarray is defined as a contiguous sequence of numbers in an array.A subarray [numsl, numsl+1, ..., numsr-1, numsr] is ascending if for all i wh..
https://leetcode.com/problems/longest-strictly-increasing-or-strictly-decreasing-subarray/description/leetcode - Longest Strictly Increasing or Strictly Decreasing Subarray문제 유형: 슬라이딩 윈도우문제 난이도: Easy 문제You are given an array of integers nums. Return the length of the longest subarray of nums which is either strictly increasing or strictly decreasing. 정수 배열 nums가 주어진다. 가장 긴 오름차순 또는 내림차순 부분배열의 길이를..
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://www.acmicpc.net/problem/1644BOJ - 소수의 연속합문제 유형: 수학, 정수론, 슬라이딩 윈도우문제 난이도: Gold III시간 제한: 2초메모리 제한: 128MB 문제하나 이상의 연속된 소수의 합으로 나타낼 수 있는 자연수들이 있다. 몇 가지 자연수의 예를 들어 보면 다음과 같다.3 : 3 (한 가지)41 : 2+3+5+7+11+13 = 11+13+17 = 41 (세 가지)53 : 5+7+11+13+17 = 53 (두 가지)하지만 연속된 소수의 합으로 나타낼 수 없는 자연수들도 있는데, 20이 그 예이다. 7+13을 계산하면 20이 되기는 하나 7과 13이 연속이 아니기에 적합한 표현이 아니다. 또한 한 소수는 반드시 한 번만 덧셈에 사용될 수 있기 때문에, 3+5+..
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://www.acmicpc.net/problem/1806BOJ - 부분합문제 유형: 부분합, 투 포인터, 슬라이딩 윈도우문제 난이도: Gold IV시간 제한: 0.5초메모리 제한: 128MB 문제10,000 이하의 자연수로 이루어진 길이 N짜리 수열이 주어진다. 이 수열에서 연속된 수들의 부분합 중에 그 합이 S 이상이 되는 것 중, 가장 짧은 것의 길이를 구하는 프로그램을 작성하시오. 입력첫째 줄에 N (10 ≤ N 출력첫째 줄에 구하고자 하는 최소의 길이를 출력한다. 만일 그러한 합을 만드는 것이 불가능하다면 0을 출력하면 된다. 풀이슬라이딩 윈도우를 이용하면 된다.매번 right를 더해줄 때마다, left쪽에서 뺄 수 있는만큼 빼본다.right를 한칸 밀면, left쪽에서는 sum이상인동..
https://leetcode.com/problems/maximum-beauty-of-an-array-after-applying-operation/description/leetcode - Maximum Beauty of an Array After Applying Operation문제 유형: 정렬, 슬라이딩 윈도우문제 난이도: Medium 문제You are given a 0-indexed array nums and a non-negative integer k.In one operation, you can do the following:Choose an index i that hasn't been chosen before from the range [0, nums.length - 1].Replace nums..
https://leetcode.com/problems/find-longest-special-substring-that-occurs-thrice-i/description/leetcode - Find Longest Special Substring That Occurs Thrice I문제 유형: 문자열 처리, 슬라이딩 윈도우문제 난이도: Medium 문제You are given a string s that consists of lowercase English letters.A string is called special if it is made up of only a single character. For example, the string "abc" is not special, whereas the stri..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/b9GE91/btsKOzRfmel/LQ24ROfjlkV0SC9MaIrI2K/img.png)
https://leetcode.com/problems/take-k-of-each-character-from-left-and-right/description/?envType=daily-question&envId=2024-11-20leetcode - Take K of Each Character From Left and Right문제 유형: 슬라이딩 윈도우문제 난이도: Medium 문제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 cha..
https://leetcode.com/problems/maximum-sum-of-distinct-subarrays-with-length-k/description/?envType=daily-question&envId=2024-11-19leetcode - Maximum Sum of Distinct Subarrays With Length K문제 유형: 슬라이딩 윈도우문제 난이도: Medium 문제You are given an integer array nums and an integer k. Find the maximum subarray sum of all the subarrays of nums that meet the following conditions:The length of the subarray is..