[leetcode, JS] 2828. Check if a String Is an Acronym of Words

mxxn·2024년 6월 14일
0

leetcode

목록 보기
180/198

문제

문제 링크 : Check if a String Is an Acronym of Words

풀이

/**
 * @param {string[]} words
 * @param {string} s
 * @return {boolean}
 */
var isAcronym = function(words, s) {
    return s === words.reduce((acc, cur) => {
        return acc+cur[0]
    }, '')
};
  1. words 요소들의 0번째 알파벳을 더한것과 문자열 s가 일치하는지 확인
  • Runtime 84 ms, Memory 52.87 MB
profile
내일도 글쓰기

0개의 댓글