Skip to content

Conversation

@ganeodolu
Copy link

@ganeodolu ganeodolu commented Nov 3, 2021

[6주차][이진 탐색][호준] 학습하고 있는 내용 정리

주차 알고리즘 정리한 내용 링크
6주차 이진탐색 이론정리 링크
6주차 이진탐색 문제풀이 링크

Q29는 문제가 잘 이해 안돼서 답 보고 풀었습니다. 다른 분들은 잘 푸셨는지 궁금해요 😓

@ganeodolu ganeodolu changed the base branch from main to ganeodolu November 6, 2021 13:08
Comment on lines +6 to +10
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
arr.forEach((val) => {
if (val > mid) {
total += val - mid;
}
});
const total = arr.reduce((acc, val) => acc + Math.max(0, val - mid), 0);

검증은 못해봤는데, reduce 로 줄여서 쓸 수도 있을거 같아요 😄

Comment on lines +28 to +29
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const N = 4,
M = 6;
const N = 4;
const M = 6;

const 하나당 하나의 식별자만 선언하는게 더 명시적이고 직관적인거 같은데, 어떻게 생각하시나욤~~

Copy link
Author

Choose a reason for hiding this comment

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

동의합니다. 이런 형식으로도 가능하다 라는 마음으로 사용해봤습니다 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

dduk ㅋㅋㅋㅋㅋㅋㅋㅋㅋ

@ganeodolu
Copy link
Author

Q29 참고
문제 해설
정답 깃허브

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants