五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

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

Leetcode 2486. Append Characters to String to Make Subsequence

2022-11-27 13:10 作者:您是打尖兒還是住店呢  | 我要投稿


Medium

30Add to ListShare

You are given two strings?s?and?t?consisting of only lowercase English letters.

Return?the minimum number of characters that need to be appended to the end of?s?so that?t?becomes a?subsequence?of?s.

A?subsequence?is a string that can be derived from another string by deleting some or no characters without changing the order of the remaining characters.

?

Example 1:

Input: s = "coaching", t = "coding"Output: 4Explanation: Append the characters "ding" to the end of s so that s = "coachingding". Now, t is a subsequence of s ("coachingding"). It can be shown that appending any 3 characters to the end of s will never make t a subsequence.

Example 2:

Input: s = "abcde", t = "a"Output: 0Explanation: t is already a subsequence of s ("abcde").

Example 3:

Input: s = "z", t = "abcde"Output: 5Explanation: Append the characters "abcde" to the end of s so that s = "zabcde". Now, t is a subsequence of s ("zabcde"). It can be shown that appending any 4 characters to the end of s will never make t a subsequence.


感覺(jué)這道題可以判斷為easy的,其實(shí)就是判斷一下,按照字符串的順序,相同的一共有多少個(gè)字符,判斷出來(lái)后,剩下就是字符串長(zhǎng)度減去相同的字符數(shù)量即可;



Runtime:?5 ms, faster than?80.00%?of?Java?online submissions for?Append Characters to String to Make Subsequence.

Memory Usage:?43.3 MB, less than?80.00%?of?Java?online submissions for?Append Characters to String to Make Subsequence.



Leetcode 2486. Append Characters to String to Make Subsequence的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
枣强县| 鄂州市| 洛扎县| 梁山县| 汉中市| 武山县| 手机| 昌宁县| 平舆县| 乳山市| 四子王旗| 江油市| 兴和县| 石柱| 赤峰市| 手机| 吉林市| 陵川县| 汉川市| 三穗县| 勃利县| 开封县| 上思县| 西乡县| 南宫市| 达尔| 武隆县| 扎赉特旗| 喀喇| 成都市| 靖江市| 焉耆| 从江县| 开远市| 楚雄市| 司法| 榆林市| 临海市| 池州市| 长顺县| 延吉市|