-
-
Couldn't load subscription status.
- Fork 244
[rivkode] WEEK 14 Solutions #1955
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
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.
자바에 toBinaryString 같은 함수가 존재하는지 몰랐네요!
| int cnt = 0; | ||
| for (int j=0; j < bit.length(); j++) { | ||
| char c = bit.charAt(j); | ||
| int num = c-'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.
이 코드가 어떤 역할을 하는 건지 궁금해요. 무작정 2로 나눠서 몫과 나머지를 통해 답을 도출한다는 생각만 했더니...
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.
안녕하세요 ㅎㅎ 아스키 코드를 사용하였습니다. 여기서 char c 는 숫자형태의 char 를 기대하고 있습니다. 그러므로 '0' 을 빼주게 되면 십진법의 Int 숫자가 반환되게 됩니다. 사실 십진법에 해당하는 48을 빼주어도 되는데 '0' 을 빼주는게 더 직관적이라 보통 숫자연산을 할때 저는 '0' 을 빼줍니다. 그러면 원하는 숫자 int 값을 얻을 수 있게 되어서요.
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.
제가 문제를 안 읽어서... poll, offer라는 함수를 쓰는 걸 처음 봤네요. 반환, 추가의 역할을 하나요?
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.
네 맞아요 poll은 Queue 자료구조에서 가장 첫번째로 들어온 요소를 반환하고 Queue에서 제거합니다. offer은 가장 마지막에 추가하는 역할을 합니다
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!