This repository was archived by the owner on Mar 18, 2024. It is now read-only.
[2023-09-11] wooyeol #205 #219
Merged
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.
PR Summary
LCS
https://www.acmicpc.net/problem/9251
풀이 참조 : https://velog.io/@emplam27/알고리즘-그림으로-알아보는-LCS-알고리즘-Longest-Common-Substring와-Longest-Common-Subsequence
풀이시간
13:22 ~ 14:22(1시간 고민 후 풀이 참고)
문제 조건
문자열의 최대 길이는 1000
시간 복잡도 :
O(N * N) = O(N^2)
접근법
무슨 알고리즘으로 풀이 할 수 있을까? -> DP
점화식:
1. 문자열A, 문자열B의 한글자씩 비교해봅니다.
2. 두 문자가 다르다면 LCS[i - 1][j]와 LCS[i][j - 1] 중에 큰값을 표시합니다.
3. 두 문자가 같다면 LCS[i - 1][j - 1] 값을 찾아 +1 합니다.
4. 위 과정을 반복합니다.