最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

leetcode 792. Number of Matching Subsequences

2022-12-24 13:16 作者:您是打尖兒還是住店呢  | 我要投稿


Medium

Given a string?s?and an array of strings?words, return?the number of?words[i]?that is a subsequence of?s.

A?subsequence?of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.

  • For example,?"ace"?is a subsequence of?"abcde".

?

Example 1:

Input: s = "abcde", words = ["a","bb","acd","ace"]Output: 3Explanation: There are three strings in words that are a subsequence of s: "a", "acd", "ace".

Example 2:

Input: s = "dsahjpjauf", words = ["ahjpjau","ja","ahbwzgqnuk","tnmlanowax"]Output: 2

?

Constraints:

  • 1 <= s.length <= 5 * 104

  • 1 <= words.length <= 5000

  • 1 <= words[i].length <= 50

  • s?and?words[i]?consist of only lowercase English letters.

用map就超時(shí),set就可以,真的是遇得到。。。


Java

Runtime124 ms

Beats

72.89%

Memory43.3 MB

Beats

95.29%


leetcode 792. Number of Matching Subsequences的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
民和| 长宁县| 合阳县| 东至县| 镇雄县| 西充县| 湄潭县| 信宜市| 马龙县| 永丰县| 平顶山市| 澄迈县| 宜宾县| 秀山| 鹤峰县| 邵东县| 沈丘县| 揭阳市| 桃江县| 齐河县| 裕民县| 莲花县| 诏安县| 公主岭市| 怀安县| 镇沅| 潜山县| 龙井市| 黎城县| 丰宁| 九台市| 邮箱| 盐亭县| 宁武县| 温泉县| 双鸭山市| 酉阳| 梁河县| 黔西| 游戏| 洛宁县|