diff --git "a/Programmers/Gayo/\355\230\270\355\205\224_\353\214\200\354\213\244.java" "b/Programmers/Gayo/\355\230\270\355\205\224_\353\214\200\354\213\244.java" new file mode 100644 index 0000000..248c7e2 --- /dev/null +++ "b/Programmers/Gayo/\355\230\270\355\205\224_\353\214\200\354\213\244.java" @@ -0,0 +1,43 @@ +import java.util.*; + +class Solution { + public int solution(String[][] book_time) { + int answer = 0; + // 손님 대기열 (입실 빠른 순) + PriorityQueue pq = new PriorityQueue<>((a, b)->{ + if(a[0]==b[0]) return Integer.compare(a[1], b[1]); + else return Integer.compare(a[0], b[0]); + }); + // 객실 관리 (종료시간 기록) + PriorityQueue arr = new PriorityQueue<>(); + + + for(int i=0; icur[0]){ + arr.add(cur[1]); + } + } + answer = arr.size(); + return answer; + } + + // 문자열 시간, 분을 분 단위 정수로 변환 + public int CalTime(int i, int n, String[][] book_time){ + String[] splitTime = book_time[i][n].split(":"); + int hour = Integer.parseInt(splitTime[0]); + int min = Integer.parseInt(splitTime[1]); + int total = hour*60 + min; + return total; + } +} \ No newline at end of file