-
-
Notifications
You must be signed in to change notification settings - Fork 245
[rivkode] WEEK 02 solutions #1758
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
Conversation
cur = all_multi / v | ||
result.append(int(cur)) | ||
elif zero_count == 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요, 이쪽에서 보고 왔습니다 ㅎㅎ #1757 (comment)
zero_count
를 통해 0을 예외처리하신 이유는 0으로의 나눗셈에서 예외가 발생하기 때문인데 이 문제는 특히 나눗셈을 하지 말라는 설명이 명시된 것처럼 나눗셈 없는 풀이가 가능해요. 결론적으로 나눗셈 없이 푼다면 0을 예외처리하지 않아도 되겠네요. 왜 나눗셈 없이 풀라고 하는 건지 의아했었는데 예외 처리를 제거할 수 있는 이점을 생각하니 덕분에 납득이 됐습니다. 감사합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아하 ..! 사실,, 저는 저 나눗셈이 영어로 무엇인지 잘 몰랐습니다 .. ㅎㅎ divide가 나누다 이고 operation은 실행 동작 이라고만 알았네요 ㅋㅋㅋ 나눗셈 = division operation 도 함께 배우고 갑니다!
저는 처음 output만 보고 0이라는 특이 케이스가 존재해서 이걸 보고 시도하고 풀어봤는데, 지금 돌이켜보니 이게 되네 ? 였네요 ㅎㅎ
친절한 설명 감사합니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다 :)
for i, v in enumerate(nums): | ||
v_set[v] = i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 리트코드에서 본 답안 코드를 제출해보셨나요? 이렇게 중복된 값이 여러 번 등장할 때 인덱스를 덮어쓰면 필요한 조합을 놓치거나 잘못된 인덱스를 사용할 수 있을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

@DaleSeo 주말 일정으로 늦게 답장을 드립니다. 넵! 제출해보았습니다, pass를 하긴 했었는데 많이 느린 편이네요 .. ㅎㅎ
그러네요 .. set을 사용하게 되면 잘못된 인덱스를 사용할 수 있을 것 같습니다. 답이 pass된 이유는 문제에서 다행히 인덱스와는 크게 관련있지 않고 고유한 조합 return 하면 되기때문이었던 것 같습니다. 항상 set으로 인덱스를 사용한다면 덮어씌워지는 부분을 주의해야겠습니다. 감사합니다~!
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!