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

[2023-09-08] dohyun #184 #213

Merged
merged 1 commit into from
Sep 12, 2023
Merged

[2023-09-08] dohyun #184 #213

merged 1 commit into from
Sep 12, 2023

Conversation

limstonestone
Copy link
Contributor

PR Summary

풀이시간

  • 약 1시간 30분

접근법

  • 하나의 단어는 접근하면 다시 사용하지 않음 (왜? 다시 접근할거면 변환을 할 필요가 없으니까, 무한 루프도는거)
  • 한번 방문한 곳은 다시 안감 + 완전탐색 + 최소 count -> BFS
  • "한 번에 한 개의 알파벳만 바꿀 수 있다" 조건만 잘 처리하자!
    • 단어의 길이가 최대 10이므로 그냥 단순 순회하며 확인해보면 될 듯함

회고

  • 한 개의 알파벳만 바꿀 수 있다 -> "BCB" 와 같은 단어가 오면 "ACA" 로도 바꿀 수 있다
    • 이렇게 해석을 잘 못해서 시간이 좀 오래 걸렸음 ㅠ ㅠ

ISSUE NUMBER

@limstonestone limstonestone self-assigned this Sep 10, 2023
@limstonestone limstonestone linked an issue Sep 10, 2023 that may be closed by this pull request
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.

BFS로 잘 풀이해내셨네요! 조건에 대한 접근도 잘 진행해주신 것 같습니다. 인덱스를 활용해서 BFS를 해주셨는데, 비교를 인덱스끼리가 아니라 인덱스로 words 리스트를 참조해서 수행하셨으면 조금 더 이해 측면에서 편리하셨을 것 같다는 생각이 드네요. 고려해보시면 좋을 것 같습니다. 고생하셨습니다!

queue = deque([len(words)-1])
visit[len(words)-1] = 0

target_idx = words.index(target)
Copy link
Contributor

Choose a reason for hiding this comment

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

밑의 BFS를 인덱스를 활용해서 풀이하셨는데, 이 라인의 과정 없이 인덱스를 활용할 때 words 리스트를 인덱스로 참조해서 비교한는 방식으로 풀이하셨어도 가독성 측면에서 좋았을 것 같습니다.

Copy link
Member

@Woo-Yeol Woo-Yeol left a comment

Choose a reason for hiding this comment

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

LGTM!

@limstonestone limstonestone merged commit 7593d25 into main Sep 12, 2023
@limstonestone limstonestone deleted the dohyun-#184 branch September 12, 2023 05:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Programmers] 단어 변환
4 participants