Check if a String Is an Acronym of Words

As a Systems Engineer at Tata Consultancy Services, I deliver exceptional software products for mobile and web platforms, using agile methodologies and robust quality maintenance. I am experienced in performance testing, automation testing, API testing, and manual testing, with various tools and technologies such as Jmeter, Azure LoadTest, Selenium, Java, OOPS, Maven, TestNG, and Postman.
I have successfully developed and executed detailed test plans, test cases, and scripts for Android and web applications, ensuring high-quality standards and user satisfaction. I have also demonstrated my proficiency in manual REST API testing with Postman, as well as in end-to-end performance and automation testing using Jmeter and selenium with Java, TestNG and Maven. Additionally, I have utilized Azure DevOps for bug tracking and issue management.
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 concatenating the first character of each string in words in order. For example, "ab" can be formed from ["apple", "banana"], but it can't be formed from ["bear", "aardvark"].
Return true if s is an acronym of words, and false otherwise.
LeetCode Problem - 2828
class Solution {
public boolean isAcronym(List<String> words, String s) {
// If the number of words in the list does not match the length of the string, it cannot be an acronym.
if(words.size() != s.length()) return false;
// Iterate through each character in the string.
for(int i = 0; i < s.length(); i++) {
// If the first character of the i-th word does not match the i-th character of the string, it's not an acronym.
if(words.get(i).charAt(0) != s.charAt(i)) {
return false;
}
}
// If all characters match, it's an acronym.
return true;
}
}




