Skip to content

호텔 대실 - #93

Open
yangyeeeun wants to merge 1 commit into
mainfrom
yee/hotel_rent
Open

호텔 대실#93
yangyeeeun wants to merge 1 commit into
mainfrom
yee/hotel_rent

Conversation

@yangyeeeun

Copy link
Copy Markdown
Collaborator

🍪 문제 이름

Resolve: 호텔 대


🍊 문제 정의

input
[["15:00", "17:00"], ["16:40", "18:20"], ["14:20", "15:20"], ["14:10", "19:20"], ["18:20", "21:20"]]
*

output
3
*


🍑 알고리즘 설계

풀이 과정에서 본인이 생각한 내용을 작성해 주세요.
시간을 분단위로 바꾸면서 우선순위 큐를 이용해서 정렬했습니다. 그런 다음 방들의 퇴실시간과 현재 입실시간을 비교해서 큐에 넣고 뺴는 방식을 활용했습니다.

# 특히 리뷰받고 싶은 코드 일부를 여기에 작성해 주세요.

while(!t_arr.isEmpty()){
int[] curr = t_arr.poll();
if(room.isEmpty()){
room.offer(curr[1]);
count++;
}else{
int prev = room.peek();
if(prev <= curr[0]){
room.remove(prev);
room.offer(curr[1]);
}else{
room.offer(curr[1]);
count++;
}
}
}

🥝 최악 수행 시간 복잡도

  • O()

🍰 특이 사항 (Optional)

참고 자료나 추가로 설명하고 싶은 내용을 작성해 주세요.

@yangyeeeun yangyeeeun self-assigned this Jul 17, 2026
@yangyeeeun yangyeeeun linked an issue Jul 17, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PGS] 호텔 대실 / level 2

1 participant