본문 바로가기
python-algorithm

leetcode 2828. Check if a String Is an Acronym of Words

by 무적김두칠 2023. 12. 28.

https://leetcode.com/problems/check-if-a-string-is-an-acronym-of-words/description/

 

Check if a String Is an Acronym of Words - LeetCode

Can you solve this real interview question? Check if a String Is an Acronym of Words - Given an array of strings words and a string s, determine if s is an acronym of words. The string s is considered an acronym of words if it can be formed by concatenatin

leetcode.com

 

1
2
3
4
5
6
7
8
9
10
class Solution:
    def isAcronym(self, words: List[str], s: str-> bool:
        check = ''
        for word in words:
            check += word[0]
        if check == s:
            return True
        else:
            return False
        
cs
반응형

댓글