Counting Words With a Given Prefix

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.
You are given an array of strings words and a string pref.
Return the number of strings in words that contain pref as a prefix.
A prefix of a string s is any leading contiguous substring of s.
LeetCode Problem - 2185
class Solution {
public int prefixCount(String[] words, String pref) {
int count = 0; // Initialize count to keep track of words starting with the prefix
for(String word : words){ // Iterate through each word in the array
if(word.startsWith(pref)){ // Check if the word starts with the given prefix
count++; // Increment count if the condition is met
}
}
return count; // Return the count of words starting with the prefix
}
}




