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

[장희직] - 왕실의 기사 대결, 메이즈 러너, 귤 고르기, 아이템 줍기 #238

Merged
merged 1 commit into from
Apr 7, 2024

Conversation

jhg3410
Copy link
Member

@jhg3410 jhg3410 commented Apr 7, 2024

📌 from issue #234 📌

📋문제 목록📋

왕실의 기사 대결: ✅
메이즈 러너: ✅
귤 고르기: ✅
아이템 줍기: ⛔️

@jhg3410 jhg3410 added the 희직 label Apr 7, 2024
@jhg3410 jhg3410 self-assigned this Apr 7, 2024
Copy link
Member

@soopeach soopeach left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!

def solution(k, tangerines):
limit = k

tan_cnt = defaultdict(int)
Copy link
Member

Choose a reason for hiding this comment

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

파이썬이 진짜 좋네요

for tangerine in tangerines:
tan_cnt[tangerine] += 1
sorted_tan_cnt = sorted(tan_cnt.values(), reverse=True)
for idx, tan_cnt in enumerate(sorted_tan_cnt):
Copy link
Member

Choose a reason for hiding this comment

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

enumerate 안쓰면 안되는건가요??

Copy link
Member Author

Choose a reason for hiding this comment

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

제가 알기론 enumerate 써야 index 같이 추출하는 걸로 알고 있어요!



def move(origin_number, number, d):
print("number:", number, "origin_number:", origin_number, "d:", d)
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.

아닙니다 ㅠㅠ 제출할 땐 제거했었어요 ㅠ

ny = y + dy[d]
if board_pos[nx][ny] != -1 and board_pos[nx][ny] != number:
new_number.append(board_pos[nx][ny])
for n_number in set(new_number):
Copy link
Member

Choose a reason for hiding this comment

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

요러면 요 포문에서 순회할 때 new_number가 리스트가 아닌 셋처럼 동작하는건가요???

Copy link
Member Author

Choose a reason for hiding this comment

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

옙!!👍



def solution(_rectangle, character_x, character_y, item_x, item_y):
rectangle = map(lambda x: list(map(lambda y: y * 2, x)), _rectangle)
Copy link
Member

Choose a reason for hiding this comment

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

오호...

Comment on lines +57 to +58
offset_x = x1
offset_y = y1
Copy link
Member

Choose a reason for hiding this comment

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

오프셋 처리를 저도 해봐야겠네요

for tangerine in tangerines:
tan_cnt[tangerine] += 1
sorted_tan_cnt = sorted(tan_cnt.values(), reverse=True)
for idx, tan_cnt in enumerate(sorted_tan_cnt):
Copy link
Member

Choose a reason for hiding this comment

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

enumerate로 idx쓰는게 깔끔하네요!

moved_pos = []


def move(origin_number, number, d):
Copy link
Member

Choose a reason for hiding this comment

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

왜인지는 모르겠지만 dfs로 풀면 힘들겠다고 생각했는데, dfs로도 잘 푸는 방법을 보게 되어 좋았습니다!



def solution(_rectangle, character_x, character_y, item_x, item_y):
rectangle = map(lambda x: list(map(lambda y: y * 2, x)), _rectangle)
Copy link
Member

Choose a reason for hiding this comment

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

덕분에 어떻게 풀어야하는지를 깨닫게 되었어요!

return answer


def bfs(character_x, character_y, item_x, item_y):
Copy link
Contributor

Choose a reason for hiding this comment

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

그냥 bfs로 탐색해도 갈 수가 있군요.....

@jhg3410 jhg3410 merged commit b4de552 into main Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants