[LeetCode] 3020. Find the Maximum Number of Elements in Subset
·
Algorithm/Review
https://leetcode.com/problems/find-the-maximum-number-of-elements-in-subset/description/?envType=daily-question&envId=2026-06-27 Find the Maximum Number of Elements in Subset - LeetCodeCan you solve this real interview question? Find the Maximum Number of Elements in Subset - You are given an array of positive integers nums. You need to select a subset of nums which satisfies the following condi..
[LeetCode] 410. Split Array Largest Sum
·
Algorithm/Review
https://leetcode.com/problems/split-array-largest-sum/description/ Split Array Largest Sum - LeetCodeCan you solve this real interview question? Split Array Largest Sum - Given an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized. Return the minimized largest sum of the split.leetcode.com 문제정의1. nums라는 배열과 정수 k가 주어..
[백준] 2306번 유전자 (C++)
·
Algorithm/Review
https://www.acmicpc.net/problem/2306 최근 dp유형이 좀 많이 약한것 같아서 다양한 문제들을 풀면서 dp에 익숙해지기로 하였다. 이 문제는 문자열이 주어지고 (a, t), (g, c) 라는 가장 짧은 KOI 유전자가 존재하며KOI 유전자에 겹쳐서 성립하는 경우도 KOI 유전자라고 하며 이때 최대 길이를 구하는 문제이다. 문제 조건에 최대 길이의 KOI 문자열을 구하기 위해서 문자 중간중간을 삭제할 수 있으며 제한은 없다. 따라서 내가 해당 문자를 선택하고 버리는 것에 따라서 미래에 영향을 주기 때문에 모든 경우의 수를 구하며 최적화를 해야한다. 따라서 dp 테이블을 정의해야한다. 스스로 해결: ❌ dp[i][j] = i구간부터 j구간까지 KOI 문자열의 최대 길이로 식을 세..
[백준] 1315번 RPG (C++)
·
Algorithm/Review
https://www.acmicpc.net/problem/1315 이 문제는 N개의 퀘스트가 주어질때 각각의 퀘스트에 필요한 요구치가 주어진다 이는 STR[i], INT[i]가 주어지며 퀘스트를 완료하기 위해서 현재 나의 스텟 중에 하나 이상이 퀘스트가 요구하는 스텟보다 크면 완료할 수 있으며 보너스로 스텟을 찍을 수 있는 포인트를 준다.이때 최대로 완료할 수 있는 퀘스트의 개수를 구하는 문제이다. 스스로 해결: ❌ 접근방법어느정도 dp를 사용해서 풀어야하는 것은 알았지만 식을 어떻게 세워야할줄 몰랐다. 현재 내가 할 수 있는 행동은 각 퀘스트마다 내 스텟과 비교하여 완료할 수 있으면 다음퀘스트를 완료할 수 있는 가능성이 높아지기 때문에 무조건 완료하는것이 좋다고 생각하였다 또한 퀘스트 완료후 보너스 ..