Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 593 Bytes

Question_2828.md

File metadata and controls

28 lines (23 loc) · 593 Bytes

LeetCode Records - Question 2828 Check if a String Is an Acronym of Words

Attempt 1:

class Solution {
    public boolean isAcronym(List<String> words, String s) {
        char[] arr = s.toCharArray();

        if (words.size() != arr.length) {
            return false;
        }

        int i = 0;
        for (String word : words) {
            if (word.charAt(0) != arr[i]) {
                return false;
            }
            i++;
        }

        return true;
    }
}
  • Runtime: 2 ms (Beats: 44.23%)
  • Memory: 44.52 MB (Beats: 42.31%)