Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

레벨1 새로운 문제 풀이 숫자 짝꿍 #109

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

Merged
codeisneverodd merged 3 commits into codeisneverodd:main from ssi02014:ssi02014
Oct 18, 2022

Conversation

Copy link
Contributor

@ssi02014 ssi02014 commented Oct 6, 2022

새롭게 추가된 문제 풀이

레벨 1 / 숫자 짝꿍 / 39fd1a4

관련 이슈


Copy link
Owner

새로운 풀이 추가 감사합니다!! 현재 레포를 버전업 하는 중이라 반영과 코드리뷰는 조금만 기다려주세요 😄

Copy link
Owner

@codeisneverodd codeisneverodd left a comment

Choose a reason for hiding this comment

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

좋은 풀이 잘 보았습니다 👍 자주 기여해주셔서 닉네임이 기억에 남네요 😄
파일명을 센스있게 변경해주셨군요! 다만 공백을 제외하는 것이 아닌, 숫자 짝궁 => 숫자-짝궁과 같이 적어주어야합니다!
기존 가이드와 같이

  1. 00-해답-예시.js 파일을 복제
  2. 문제 제목을 복사 붙여넣고, 공백을 '-'로 변경
    과 같은 방식으로 파일을 생성하시는 것을 권장드립니다!
    숫자-짝궁.js와 같이 작성해주셔도 자동으로 파일명이 변환되니 편하신 방법으로 하시면 되겠습니다! 기여해주셔서 감사합니다😄

ssi02014 reacted with thumbs up emoji

if (!commons.length) return "-1";
else if (commons[0] === "0") return "0";
return commons.reduce((acc, cur) => acc + cur, "");
Copy link
Owner

@codeisneverodd codeisneverodd Oct 10, 2022

Choose a reason for hiding this comment

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

배열을 합하여 문자열로 만드는 것이라면, join 메서드도 좋을 것 같습니다!

Suggested change
return commons.reduce((acc,cur)=>acc+cur,"");
return commons.join('');

ssi02014 reacted with thumbs up emoji
Copy link
Contributor Author

@ssi02014 ssi02014 Oct 10, 2022
edited
Loading

Choose a reason for hiding this comment

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

아우 join을 생각하기 못했네요 감사합니다 :)

Comment on lines 1 to 6
/**
* 풀이 - ssi02014
* X, Y의 길이가 굉장히 길어서 공통 숫자를 뽑아낼 때 객체를 이용해 연산 횟수 최적화
* X, Y를 배열로 변환 후에 배열 메서드를 사용해도 되지만, for of문보다 효율성 떨어짐
* (테스트 케이스 11 ~ 15 100ms~200ms 차이)
*/
Copy link
Owner

@codeisneverodd codeisneverodd Oct 10, 2022

Choose a reason for hiding this comment

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

친절한 주석 너무 좋습니다 😄
다만 기본 형식과 맞게 가장 상단에 다음과 같은 주석을 추가해주세요!

//https://github.com/codeisneverodd/programmers-coding-test
//더 좋은 풀이가 존재할 수 있습니다.
//정답 1 - ssi02014

ssi02014 reacted with thumbs up emoji
Copy link
Contributor Author

@codeisneverodd 아이고ᅲ 주석 부분이랑 join, 파일명 수정하였습니다

codeisneverodd reacted with thumbs up emoji codeisneverodd reacted with laugh emoji

@codeisneverodd codeisneverodd merged commit c211cc9 into codeisneverodd:main Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@codeisneverodd codeisneverodd codeisneverodd left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /