import java.util.*;
class Solution {
public int solution(String[][] book_time) {
int answer = 0;
//start end 로 나누어서 북타임을 쪼개야함
int[][]bookInt = new int[book_time.length][book_time[0].length];
for(int i =0 ;i<book_time.length; i++){
int start = Integer.parseInt(book_time[i][0].replace(":",""));
int end = Integer.parseInt(book_time[i][1].replace(":",""));
end += 10;
if(end%100 >= 60){
end+=40;
}
bookInt[i][0] = start;
bookInt[i][1] = end;
}
// 정렬
Arrays.sort(bookInt, (o1,o2)->o1[0]==o2[0]?o1[1]-o2[1]:o1[0]-o2[0]);
//System.out.println(Arrays.deepToString(bookInt));
// 우선순위큐
PriorityQueue<Integer>que = new PriorityQueue<>();
for(int[]temp : bookInt){
if(que.isEmpty()){
que.add(temp[1]);
}else{
if(que.peek()>temp[0]){
que.add(temp[1]);
}else{
que.poll();
que.add(temp[1]);
}
}
}
return que.size();
}
}
if(end%100 >= 60){
end+=40;
}
이 부분이 헷갈릴 수 도 있는데
15시50분인 경우 1550 으로 치환되고 뒤에 있는 분만 추출하기 위해 %100을해준 것이다.
그리고 10분의 여유가 필요함으로 +10을 했을때 60분이 넘어가는 경우 처리를 해주어야한다.
15시55분인경우 1555가 되고 여기서 10분을 더하면 1565이다.
15시 65분은 없기에 여기서 나와야하는 답은 1605 이다.
그래서 1565 -> 1605를 만들기 위해 40을 더해준다.