목록다이나믹 프로그래밍 (5)
넘치게 채우기
https://www.acmicpc.net/problem/2568BOJ - 전깃줄 - 2문제 유형: 가장 긴 증가하는 부분 수열(LIS), 다이나믹 프로그래밍문제 난이도: Platinum V시간 제한: 1초메모리 제한?: 128초 문제두 전봇대 A와 B 사이에 하나 둘씩 전깃줄을 추가하다 보니 전깃줄이 서로 교차하는 경우가 발생하였다. 합선의 위험이 있어 이들 중 몇 개의 전깃줄을 없애 전깃줄이 교차하지 않도록 만들려고 한다.예를 들어, 과 같이 전깃줄이 연결되어 있는 경우 A의 1번 위치와 B의 8번 위치를 잇는 전깃줄, A의 3번 위치와 B의 9번 위치를 잇는 전깃줄, A의 4번 위치와 B의 1번 위치를 잇는 전깃줄을 없애면 남아있는 모든 전깃줄이 서로 교차하지 않게 된다. 전깃줄이 전봇대에 연결..
https://www.acmicpc.net/problem/14003BOJ - 가장 긴 증가하는 부분 수열 5문제 유형: LIS(Longest Increasing Subsequence), 다이나믹 프로그래밍, 이진 탐색문제 난이도: Platinum V시간 제한: 3초메모리 제한: 512MB 문제수열 A가 주어졌을 때, 가장 긴 증가하는 부분 수열을 구하는 프로그램을 작성하시오.예를 들어, 수열 A = {10, 20, 10, 30, 20, 50} 인 경우에 가장 긴 증가하는 부분 수열은 A = {10, 20, 10, 30, 20, 50} 이고, 길이는 4이다. 입력첫째 줄에 수열 A의 크기 N (1 ≤ N ≤ 1,000,000)이 주어진다.둘째 줄에는 수열 A를 이루고 있는 Ai가 주어진다. (-1,000,..
https://leetcode.com/problems/filling-bookcase-shelves/?envType=daily-question&envId=2024-07-31leetcode - Filling Bookcase Shelves문제 유형 : 다이나믹 프로그래밍문제 난이도 : Medium 문제You are given an array books where books[i] = [thicknessi, heighti] indicates the thickness and height of the ith book. You are also given an integer shelfWidth.We want to place these books in order onto bookcase shelves that have a..
https://leetcode.com/problems/minimum-deletions-to-make-string-balanced/description/?envType=daily-question&envId=2024-07-30leetcode - Minimum Deletions to Make String Balanced문제 유형 : 다이나믹 프로그래밍문제 난이도 : Medium 문제You are given a string s consisting only of characters 'a' and 'b'.You can delete any number of characters in s to make s balanced. s is balanced if there is no pair of indices (i,j)..
https://leetcode.com/problems/arithmetic-slices-ii-subsequence/description/ Arithmetic Slices II - Subsequence - LeetCode Can you solve this real interview question? Arithmetic Slices II - Subsequence - Given an integer array nums, return the number of all the arithmetic subsequences of nums. A sequence of numbers is called arithmetic if it consists of at least three elements leetcode.com leetco..