Skip to content

0401프로그래머스#33

Open
platycodonv wants to merge 1 commit into
mainfrom
origin/platycodonv_0401
Open

0401프로그래머스#33
platycodonv wants to merge 1 commit into
mainfrom
origin/platycodonv_0401

Conversation

@platycodonv

Copy link
Copy Markdown
Collaborator

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

0401프로그래머스 문제 1번,2번
@ghost
ghost requested review from a user, Kuuuna98, taboowiths and tgb02087 March 31, 2022 17:52
@ghost ghost assigned platycodonv Mar 31, 2022
@ghost ghost added the in progress 진행중입니다. label Mar 31, 2022
Comment thread playcodonv/Solution2.java
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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

매우 좋은 코드였습니다. 감사합니다 !

Comment thread playcodonv/Solution2.java

String sector = "";
for(int i = 0; i<change.length();i++) {
if(change.charAt(i) != '0') sector += change.charAt(i);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

String에 + 연산이 많아질거 같은 경우에는 StringBuilder를 사용하는 것을 권장합니다 !
image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

좋아용~

Comment thread playcodonv/Solution2.java
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) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for문이 반복할 때마다 조건문을 확인하기 때문에, 매번 Math.sqrt() 함수가 실행됩니다
변수로 저장해서 사용하면 sqrt함수 실행을 한번만 하기 때문에 시간적으로 더 좋은 코드가 될 수 있을 거라 생각합니다~~!😺

@Kuuuna98 Kuuuna98 added the una confirm 확인~! :P label Mar 31, 2022
@ghost ghost added the invitejay confirm 권용재 검출기에 통과했습니다 label Apr 1, 2022
@tgb02087 tgb02087 added the zlzonKH zi존강호 label Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in progress 진행중입니다. invitejay confirm 권용재 검출기에 통과했습니다 una confirm 확인~! :P zlzonKH zi존강호

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants