issues
search
Algogosu
/
algorithm-solving
알고리즘 문제풀기 스터디
0
stars
4
forks
source link
conoh: week3
#18
Closed
cuwhenicu
closed
4 months ago
cuwhenicu
commented
4 months ago
백준 14501: 퇴사
dp 배열을 사용해서 각 날짜까지 최대 수익을 저장
각 날짜마다 상담을 할지 말지 결정
상담을 할 경우, 상담 기간 이후 날짜의 최대 수익 갱신
마지막 날까지 최대 수익 반환
백준 1324: 젠장
LCIS를 활용한 문제
(LCIS: 두 배열이 주어졌을 때 두 배열에 공통으로 존재하면서 각 배열에서 순서를 유지하는 가장 긴 증가 부분 수열)
두 배열 day1과 day2의 요소를 각각 비교
DP 배열을 사용해 두 배열에서 공통적인 증가 부분 수열의 길이 기록
최종적으로 DP 배열에서 가장 큰 값을 찾아 반환
(이 문제는 풀지 못했습니다. 자료구조에 대한 이해가 좀 더 필요하다는 것을 느꼈습니다 ㅜㅜ)
LeetCode 746: Min Cost Climbing Stairs
dp 배열을 초기화하고 첫번째와 두번째 계단의 비용 설정
각 계단의 최소 비용을 계산해서 dp 배열 채우기
마지막 계단까지 도달하는 최소 비용 반환
qus0in
commented
4 months ago
수고하셨습니다 👍
백준 14501: 퇴사
백준 1324: 젠장
LeetCode 746: Min Cost Climbing Stairs