const arr = [2,4,1,-5,2,-3]
const sum = [0,2,6,7,2,4,1]
sum[1] === arr[0]
sum[2] === arr[0] + arr[1]
sum[i] === arr[0] + arr[1] + .... + arr[i - 1]
const arr = [[1,2,3,4], [2,3,4,5], [3,4,5,6], [4,5,6,7]]
const sum = [[0,0,0,0], [0,1,3,6,10], [0,3,8,15,24], [0,6,15,27,42], [0,10,24,42,64]]
sum[i][j] === arr[0][0] + ..... + arr[i-1][j-1]
function solution(book_time) {
let answer = 0;
const MAX_TIME = 1450;
const rooms = new Array(MAX_TIME);
rooms.fill(0);
book_time.forEach((v) => {
rooms[calTime(v[0])] += 1;
rooms[calTime(v[1]) + 10] += -1;
});
for (let i = 1; i < MAX_TIME; i++) {
rooms[i] += rooms[i - 1];
answer = Math.max(answer, rooms[i]);
}
return answer;
}
function calTime(time) {
const splitTime = time.split(':');
const hour = splitTime[0];
const miniutes = splitTime[1];
return parseInt(hour) * 60 + parseInt(miniutes);
}