Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

53-tgyuuAn #184

Merged
merged 1 commit into from
May 13, 2024
Merged

53-tgyuuAn #184

merged 1 commit into from
May 13, 2024

Conversation

tgyuuAn
Copy link
Member

@tgyuuAn tgyuuAn commented May 11, 2024

🔗 문제 링크

2048 (Easy)

✔️ 소요된 시간

3시간

하.... 진짜 구현 짜중나네요...

✨ 수도 코드

구현 자체는 매우 간단합니다.

보드의 크기가 최대 20이고 최대 5번으로 만들 수 있는 최대 수를 구하는 로직이기 때문에,

최근에 홍주님이 열심히 공부하고 계시는 백트래킹 활용하면

$(20*20) * 4^5 = 400 * 1024 -> 40만$

$(최대 보드 크기 20 * 20) * (4방향) ^ 5 $




으로 풀 수 있어요. 근데 이제 구현이 너무 귀찮은..

image




저도 한 2시간 잡고 있다가 화딱지나서 레퍼런스 보고 풀었습니다.

image




풀이는 진짜 간단한데... 건강에 해로운 문제에요...

📚 새롭게 알게된 내용

@tgyuuAn tgyuuAn added tgyuuAn 한 줄로는 소개할 수 없는 남자. 작성 중 ⏱️ labels May 11, 2024
@tgyuuAn tgyuuAn requested a review from H0ngJu May 11, 2024 10:16
@tgyuuAn tgyuuAn self-assigned this May 11, 2024
@tgyuuAn tgyuuAn marked this pull request as ready for review May 11, 2024 11:23
Comment on lines +98 to +107
for i in range(4):
copy_arr = copy.deepcopy(arr)
if i == 0:
dfs(n + 1, left(copy_arr))
elif i == 1:
dfs(n + 1, right(copy_arr))
elif i == 2:
dfs(n + 1, up(copy_arr))
else:
dfs(n + 1, down(copy_arr))
Copy link
Member

Choose a reason for hiding this comment

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

왼쪽으로 움직인 경우를 만든 후에
오른쪽으로 움직일 때는 왼쪽으로 움직인 게임판을 이어서 이용하는 것이 아니라
왼쪽으로 움직이기 전의 게임판을 오른쪽으로 움직여야 하기 때문에
깊은 복사를 통해서 하게 되었군요!!!

이팀은 문제 수준이 너무 높은데 내일부터 잘부탁드립니다!!!!!!🔥🔥🔥

Copy link
Member Author

Choose a reason for hiding this comment

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

문제 수준 높지 않습니다... 다 하면 풀리는 것들 ....!!!!!!!!!!!! 아자뵤!!!!!!!!!!!

Copy link
Collaborator

@H0ngJu H0ngJu left a comment

Choose a reason for hiding this comment

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

이 문제 쉽지 않네요 .. 😅
아침부터 문제 고민하다가 태규님 코드 + 레퍼런스 보고 겨우 이해했습니다 .. ㄷㄷ

최종 코드가 생각보다 단순하네요 쩝.. 다음에 문제 재도전해보겠습니다 🔥🔥🔥

deepcopy << 이거 처음 알았어요
python의 shallow copy 와 deep copy에 대해서 알아갑니다 !!

shallow copy는 참조값을 복사하므로 shallow copy된 데이터를 수정하면 원본이 바뀌고,
deep copy는 객체를 복사하므로 deep copy된 데이터를 수정하면 원본이 바뀌지 않는다!

덕분에 알아갑니닷 ~!!! (_ _) feat. @9kyo-hwang & @gjsk132

@tgyuuAn
Copy link
Member Author

tgyuuAn commented May 13, 2024

이 문제 쉽지 않네요 .. 😅 아침부터 문제 고민하다가 태규님 코드 + 레퍼런스 보고 겨우 이해했습니다 .. ㄷㄷ

최종 코드가 생각보다 단순하네요 쩝.. 다음에 문제 재도전해보겠습니다 🔥🔥🔥

deepcopy << 이거 처음 알았어요 python의 shallow copy 와 deep copy에 대해서 알아갑니다 !!

shallow copy는 참조값을 복사하므로 shallow copy된 데이터를 수정하면 원본이 바뀌고, deep copy는 객체를 복사하므로 deep copy된 데이터를 수정하면 원본이 바뀌지 않는다!

덕분에 알아갑니닷 ~!!! (_ _) feat. @9kyo-hwang & @gjsk132

와우 이번에 deepcopy에 대해서 얻어가셨군요

아주 네이쑤~~~~~~~~~~~~~~~~~~~~~~ 👏🏻👏🏻👏🏻

@tgyuuAn tgyuuAn merged commit b1681b5 into main May 13, 2024
1 check passed
@tgyuuAn tgyuuAn deleted the 53-tgyuuAn branch May 13, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tgyuuAn 한 줄로는 소개할 수 없는 남자. 리뷰 완료 ✔️
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants