Conversation
Implement a solution to count the number of boxes needed based on input sizes.
Closed
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.
🚀 이슈 번호
Resolve: {#2299}
🧩 문제 해결
스스로 해결: ✅
🔎 접근 과정
🔹 어떤 알고리즘을 사용했는지 : 노가다..?
🔹 어떤 방식으로 접근했는지
처음에는 그래프로 그리드를 표현해서 생각해보려고 했습니다. 우선순위큐에 현재 그리드에 들어간 변의 최대값과 그래프 상태를 저장하도록 하려고 했습니다. 그래서 추후 뺄 때, 가장 공간이 많은 칸부터 빼고, for x in range(6)을 돌면서 자리를 넣으려고 했는데... 공간복잡도, 시간 복잡도 둘다 말이 안될 것 같았습니다.
일단, 무조건 새로운 색종이를 추가해야하는 상황과 있는 색종이로 해결할 수 있는 상황이 명확하게 나뉩니다.
무조건 새로운 색종이 추가 : 33, 44, 55, 66, 그리고 상황에 따라 11, 22
있는 색종이로 해결가능한 상황 : 11, 22
이 두 케이스를 나눠서 생각하고, 남는 공간은 11이 들어갈 수 있는 공간의 개수, 22이 들어갈 수 있는 공간의 개수를 누적하면서 구하도록 했습니다.
시간이 있다면 코드를 더 이쁘게 할 수 있는데, 이건 스터디 끝나고...ㅎㅎ
⏱️ 시간 복잡도
O(?)💻 구현 코드