Merged
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.
📎 문제 링크
https://school.programmers.co.kr/learn/courses/30/lessons/84512?language=java
📝 풀이 내용
모든 경우의 수를 만들어서 map에 저장해두고, map에서 word를 찾는 방식으로 구현했다.
📌 다른 풀이
나는 완전탐색으로 풀었지만, 수학적으로 해결하는 것도 가능하다.
5번째자리가 바뀌려면 총 1개의 단어만 바뀌면 됨. (5번째자리)
하지만 4번째 자리가 바뀌려면 선제적으로 5번째 자리가 먼저 바뀌어야 하기 때문에
5 (5번째 자리 바뀌기) + 1 (4번째 자리는 1개만 바꿔주면 됨) = 6
같은 방식으로 3번째 자리가 바뀌려면
5 *5 + 5 + 1 = 31
2번째 자리는 156
1번째 자리는 781
따라서 A, E, I, O, U에 각각 {0, 1, 2, 3, 4} 가중치를 주고
영향력 * 가중치 + 1
로 각 자리를 계산해주면 된다.
💬 리뷰 요구사항