1ms | Beats 100% Easy Solution
IntuitionWhen tasked with determining if a given string s is an acronym formed from a list of words, my first thought is to check if the first letter of each wo
# Intuition
When tasked with determining if a given string s is an acronym formed from a list of words, my first thought is to check if the first letter of each word in the list corresponds to each character in the string s. If the lengths of the list and the string do not match, it’s immediately clear that s cannot be an acronym for those words.

# Approach
1) Length Check: First, verify if the number of words in the list matches the length of the string s. If they are not equal, return false.
2) Character Comparison: Iterate through each word in the list, and for each word, check if its first character matches the corresponding character in s.
3) Return Result: If all characters match during the iteration, return true. If any character does not match, return false immediately.

# Complexity
- Time complexity: O(n)
Where n is the number of words in the list (or equivalently, the length of string s). The function performs a single pass through both structures.

- Space complexity: O(1)
The space used does not depend on the size of the input; we only use a constant amount of space for variables.

# Code
```java []
class Solution {
    public boolean isAcronym(List<String> words, String s) {
        if (words.size() != s.length()) {
            return false;
        }
       
        for(int i=0; i<words.size(); i++) {
            if(words.get(i).charAt(0) != s.charAt(i)) {
                return false;
            } 
        }
        return true;
    }
}
```
['Array', 'String', 'Java']