[Programmers] (2018

https://school.programmers.co.kr/learn/courses/30/lessons/17683

function solution(m, musicinfos) {
    m = m.replaceAll('C#', 'c').replaceAll('D#', 'd').replaceAll('F#', 'f').replaceAll('G#', 'g').replaceAll('A#', 'a');

    return musicinfos.reduce((acc, data) => {
        const (start, end, title, tempSheet) = data.split(',');
        const getMin = (time) => parseInt(time(0)) * 60 + parseInt(time(1));
        const playTime = getMin(end.split(':')) - getMin(start.split(':'));
        const sheet = tempSheet.replaceAll('C#', 'c').replaceAll('D#', 'd').replaceAll('F#', 'f').replaceAll('G#', 'g').replaceAll('A#', 'a');
        const newSheet = sheet.repeat(Math.floor(playTime / sheet.length)) + sheet.substr(0, Math.floor(playTime % sheet.length));

        if (newSheet.includes(m) && playTime > acc.TIME) acc = { TITLE: title, TIME: playTime };
        return acc;
    }, { TITLE: "(None)", TIME: 0 }).TITLE;
}

깃허브: https://github.com/developeSHG/Algorithm-Baekjoon_Programmers/tree/main/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC %8A%A4/lv2/17683.%E2%80%85%EF%BC%BB3%EC%B0%A8%EF%BC%BD%E2%80%85%EB%B0%A9%EA%B8% 88%EA%B7%B8%EA%B3%A1

GitHub – developereSHG/Algorithm-Baekjoon_Programmers: 백준과 프로그래머의 소스 코드

백준과 프로그래머의 소스 코드. GitHub에서 계정을 생성하여 DevelopeSHG/Algorithm-Baekjoon_Programmers 개발에 기여하십시오.

github.com