-
Notifications
You must be signed in to change notification settings - Fork 1
0401프로그래머스 #33
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
base: main
Are you sure you want to change the base?
0401프로그래머스 #33
Conversation
0401프로그래머스 문제 1번,2번
| if(number == 0) return false; | ||
| if(number == 1) return false; | ||
| if(number == 2) return true; | ||
| for(int i = 3; i<=Math.sqrt(number); i = i+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.
매우 좋은 코드였습니다. 감사합니다 !
|
|
||
| String sector = ""; | ||
| for(int i = 0; i<change.length();i++) { | ||
| if(change.charAt(i) != '0') sector += change.charAt(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.
좋아용~
| if(number == 0) return false; | ||
| if(number == 1) return false; | ||
| if(number == 2) return true; | ||
| for(int i = 3; i<=Math.sqrt(number); i = i+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.
for문이 반복할 때마다 조건문을 확인하기 때문에, 매번 Math.sqrt() 함수가 실행됩니다
변수로 저장해서 사용하면 sqrt함수 실행을 한번만 하기 때문에 시간적으로 더 좋은 코드가 될 수 있을 거라 생각합니다~~!😺

0401프로그래머스 문제 1번,2번