LeetCode --- 2185. Counting Words With a Given Prefix 解题报告

Question:

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.

prefix of a string s is any leading contiguous substring of s.

Example 1:

Input: words = ["pay","attention","practice","attend"], pref = "at"
Output: 2
Explanation: The 2 strings that contain "at" as a prefix are: "attention" and "at

你可能感兴趣的:(Python,算法,LeetCode,leetcode,算法,数据结构,python,面试)