Skip to content

Commit

Permalink
meeting rooms 설명 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
wad-jangjaejeong committed Nov 7, 2024
1 parent ea27d10 commit 5e4edb4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion meeting-rooms/jaejeong1.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ public class Solution {
* @return: if a person could attend all meetings
*/
public boolean canAttendMeetings(List<Interval> intervals) {
// Write your code here
// 풀이: 정렬 후 양옆을 비교해가며 조건에 맞지 않으면 false 를 반환한다.
// TC: O(N)
// SC: O(1)

var sortedIntervals = intervals.stream().sorted().toList();

for (int i=0; i<sortedIntervals.size()-1; i++) {
Expand Down

0 comments on commit 5e4edb4

Please sign in to comment.