Skip to content

[박종훈] 12주차 답안 제출 #187

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
merged 5 commits into from
Jul 22, 2024

Conversation

@dev-jonghoonpark dev-jonghoonpark marked this pull request as ready for review July 17, 2024 10:54
Copy link
Member

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

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

image

Comment on lines +76 to +91
public int lengthOfLIS(int[] nums) {
ArrayList<Integer> subsequence = new ArrayList<>();

for (int current : nums) {
// Collections.binarySearch : 목록에 포함된 경우 검색 키의 인덱스, 그렇지 않으면 (-(삽입점) - 1) 을 반환함.
int pos = Collections.binarySearch(subsequence, current);
if (pos < 0) pos = -(pos + 1);
if (pos >= subsequence.size()) {
subsequence.add(current);
} else {
subsequence.set(pos, current);
}
}

return subsequence.size();
}
Copy link
Member

@DaleSeo DaleSeo Jul 21, 2024

Choose a reason for hiding this comment

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

와, 종훈님의 이 풀이를 보고 와 이렇게 접근할 수도 있구나 충격을 받았습니다. 덕분에 이 문제를 다시 풀고 알고달레에 풀이 5와 풀이 6을 추가하게 되었네요. 신선한 영감을 주셔서 감사합니다! 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DaleSeo 칭찬 감사드립니다 : ) 🥰

@dev-jonghoonpark dev-jonghoonpark merged commit 32197f2 into DaleStudy:main Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants