DDSA
Advertisement

2185. Counting Words With a Given Prefix

2185.cs
C#
public class Solution
{
    public int PrefixCount(string[] words, string pref)
    {
        return words.Count(w => w.StartsWith(pref));
    }
}
Advertisement
Was this solution helpful?