2022/12/24

LeetCode 1678. Goal Parser Interpretation

問題:解析符文,將其取代為對應文字 解法:直接將對應名稱取代即可 JavaScript
/**
 * @param {string} command
 * @return {string}
 */
var interpret = function (command) {
    if (command.length < 1 || command.length > 100) {
        return;
    }

    return command.replaceAll('(al)', 'al').replaceAll('()', 'o');
};