-
Notifications
You must be signed in to change notification settings - Fork 3
[정민서-11주차 알고리즘 스터디] #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
minseojeong1012
wants to merge
50
commits into
SSAFY13th-algorithm:minseojeong/week11
Choose a base branch
from
minseojeong1012:main
base: minseojeong/week11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[정민서-11주차 알고리즘 스터디] #17
minseojeong1012
wants to merge
50
commits into
SSAFY13th-algorithm:minseojeong/week11
from
minseojeong1012:main
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 싸피 15반 알고리즘 스터디 11주차 [정민서]
📌 문제 풀이 개요
✅ 문제 해결 여부
💡 풀이 방법
문제 1: 알고스팟
문제 난이도
골드 4
문제 유형
다익스트
접근 방식 및 풀이
우선순위 큐를 활용한 다익스트라 알고리즘을 사용해 문제를 해결했습니다.
벽으로는 이동할 수 없기에 조건을 주고, 운영진이 모두 같은 방에 있어야 한다는 조건 아래 구현해나갔습니다.
2차원 배열을 사용해서 거리를 관리해주었습니다.
문제 2: 2×n 타일링 2
문제 유형
DP
문제 난이도
실버 3
접근 방식 및 풀이
DP의 가장 핵심적인 내용이라고 생각합니다.
끝에 세로 타일 하나 추가될 경우, 끝에 가로 타일 2개가 추가될 경우, 2X2 타일이 추가될 경우를 고려하면
arr[i - 1] + 2 * arr[i - 2])
이런 점화식이 도출됩니다
문제 3: LCS
문제 유형
DP
문제 난이도
골드 5
접근 방식 및 풀이
문자가 같으면
dp[i][j] = dp[i-1][j-1] + 1
문자가 다르면
dp[i][j] = max(dp[i-1][j], dp[i][j-1])
이런방식으로 반복문을 돌렸습니다
마지막으로 배열에 있는 최종값을 꺼내 출력했습니다
문제 4: 평범한 배낭
문제 유형
DP
문제 난이도
골드 5
접근 방식 및 풀이
물건 i 안 넣는다
→ dp[i][w] = dp[i-1][w]
물건 i 넣는다 (단, 무게 여유가 있을 때)
→ dp[i][w] = dp[i-1][w - weight[i]] + value[i]
이렇게 두개의 식을 구성하고 두 경우의 수 중 MAX 값을 구해야하기 때문에 MAX 연산을 추가하였습니다.
dp[i][w] = max(dp[i-1][w], dp[i-1][w - weight[i]] + value[i])
문제 5:
문제 유형
문제 난이도
접근 방식 및 풀이