목록모노토닉 스택 (4)
넘치게 채우기
https://leetcode.com/problems/apply-operations-to-maximize-score/description/leetcode - Apply Operations to Maximize Score문제 유형: 모노토닉 스택, 스택, 그리디, 정수론, 정렬문제 난이도: Hard 문제You are given an array nums of n positive integers and an integer k.Initially, you start with a score of 1. You have to maximize your score by applying the following operation at most k times:Choose any non-empty subarray nums[l,..

https://www.acmicpc.net/problem/6549BOJ - 히스토그램에서 가장 큰 직사각형문제 유형: 히스토그램, 스택(모노토닉 스택), 세그먼트 트리, 분할 정복, 투 포인터문제 난이도: Platinum V시간 제한: 1초메모리 제한: 256MB 문제히스토그램은 직사각형 여러 개가 아래쪽으로 정렬되어 있는 도형이다. 각 직사각형은 같은 너비를 가지고 있지만, 높이는 서로 다를 수도 있다. 예를 들어, 왼쪽 그림은 높이가 2, 1, 4, 5, 1, 3, 3이고 너비가 1인 직사각형으로 이루어진 히스토그램이다.히스토그램에서 가장 넓이가 큰 직사각형을 구하는 프로그램을 작성하시오. 입력입력은 테스트 케이스 여러 개로 이루어져 있다. 각 테스트 케이스는 한 줄로 이루어져 있고, 직사각형의 수 ..
https://leetcode.com/problems/find-building-where-alice-and-bob-can-meet/description/leetcode - Find Building Where Alice and Bob Can Meet문제 유형: 이진 탐색, 모노토닉 스택문제 난이도: Hard 문제You are given a 0-indexed array heights of positive integers, where heights[i] represents the height of the ith building.If a person is in building i, they can move to any other building j if and only if i and heights[i] Yo..
https://leetcode.com/problems/maximum-width-ramp/description/?envType=daily-question&envId=2024-10-10leetcode - Maximum Width Ramp문제 유형 : 스택, 모노토닉 스택문제 난이도 : Medium 문제A ramp in an integer array nums is a pair (i, j) for which i and nums[i] width of such a ramp is j - i.Given an integer array nums, return the maximum width of a ramp in nums. If there is no ramp in nums, return 0. 정수 배열 nums의 ra..