Skip to content

[mallayon] Week 13 #1069

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
Mar 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions meeting-rooms/mmyeon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
*@link https://leetcode.com/problems/meeting-rooms/description/
*
* 접근 방법 :
* - 미팅 시작 시간이 빠른 순으로 정렬
* - 현재 미팅 시작 시간이 이전 미팅 끝나는 시간보다 작으면 겹치는 것이므로 false 리턴
*
* 시간복잡도 : O(nlogn)
* - n = intervals의 길이, 정렬했으므로 O(nlogn)
*
* 공간복잡도 : O(1)
* - 고정된 변수만 사용
*/

function canAttendMeetings(intervals: number[][]): boolean {
intervals.sort((a, b) => a[0] - b[0]);

for (let i = 1; i < intervals.length; i++) {
const previousMeetingTime = intervals[i - 1];
const currentMeetingTime = intervals[i];
if (currentMeetingTime[0] < previousMeetingTime[1]) return false;
}

return true;
}
Comment on lines +15 to +25
Copy link
Contributor

Choose a reason for hiding this comment

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

@mmyeon 님 안녕하세요. 저도 같은 방식으로 문제를 풀었습니다. 아직 문제를 푸는 중이신 것 같네요! 주말까지 파이팅입니다 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KwonNayeon 님 안녕하세요!
이번 주 리뷰 요청이 늦었네요ㅠㅠ 시간 내어서 리뷰 해주셔서 정말 감사합니다!
이번 주도 문제 푸느라 정말 고생 많으셨어요 👍
벌써 13주라니 놀라워요. 남은 기간도 같이 힘내보아요. 즐거운 주말 되세요!! 😄