-
-
Notifications
You must be signed in to change notification settings - Fork 247
[njngwn] WEEK 06 solutions #1866
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
This reverts commit 93385ae.
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.
막대기에 따라 x,y 축을 구해서 면적을 구하는 로직과 투 포인터의 인덱스를 업데이트하는 로직을 분리해도 좋을 것 같아요!
다른 코드들도 풀이가 좋아서 많이 배웠습니다.
// 면적 구하는 로직
int y = Math.min(height[start], height[end]);
int x = end - start;
int calculatedArea = x * y;
area = Math.max(area, calculatedArea);
// 인덱스 업데이트 로직
if (height[start] <= height[end]) start++;
else end--;
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.
6주차 문제 풀이 고생하셨습니다!
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!