Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

[2023-09-11] wooyeol #205 #219

Merged
merged 1 commit into from
Sep 11, 2023
Merged

[2023-09-11] wooyeol #205 #219

merged 1 commit into from
Sep 11, 2023

Conversation

Woo-Yeol
Copy link
Member

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. 위 과정을 반복합니다.

@Woo-Yeol Woo-Yeol added the BOJ label Sep 11, 2023
@Woo-Yeol Woo-Yeol self-assigned this Sep 11, 2023
@Woo-Yeol Woo-Yeol linked an issue Sep 11, 2023 that may be closed by this pull request
Copy link
Contributor

@limstonestone limstonestone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 해당 문제 풀이에 실패했는데 다음 번에는 꼭 풀 수 있었으면 좋겠네요 ㅎㅎ
수고 많으셨습니다!!!!

Copy link
Contributor

@zsmalla zsmalla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳! 메트릭스를 그리더라도 풀이 참조의 블로그 설명처럼 각 셀이 어떤 것을 의미하는 지에 초점을 두고 접근하면 더 이해가 쉬울 것입니다. 고생하셨어요!

@ksumini
Copy link
Contributor

ksumini commented Sep 11, 2023

충분히 고민하시고, 풀이 보시면서도 이해 안되는 부분을 정확히 다 짚고 넘어가셨으니까 우열님이라면 다음 번엔 무조건 푸실거에요!! 고생하셨습니다 :)

@Woo-Yeol Woo-Yeol merged commit 32c6085 into main Sep 11, 2023
@Woo-Yeol Woo-Yeol deleted the wooyeol-#205 branch September 11, 2023 12:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BOJ] LCS
4 participants