无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

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

leetcode1957. Delete Characters to Make Fancy String

2022-04-07 10:44 作者:您是打尖兒還是住店呢  | 我要投稿

A?fancy string?is a string where no?three?consecutive?characters are equal.

Given a string?s, delete the?minimum?possible number of characters from?s?to make it?fancy.

Return?the final string after the deletion. It can be shown that the answer will always be?unique.

?

Example 1:

Input: s = "leeetcode"Output: "leetcode"Explanation:Remove an 'e' from the first group of 'e's to create "leetcode". No three consecutive characters are equal, so return "leetcode".

Example 2:

Input: s = "aaabaaaa"Output: "aabaa"Explanation:Remove an 'a' from the first group of 'a's to create "aabaaaa". Remove two 'a's from the second group of 'a's to create "aabaa". No three consecutive characters are equal, so return "aabaa".

Example 3:

Input: s = "aab"Output: "aab"Explanation: No three consecutive characters are equal, so return "aab".

?

Constraints:

  • 1 <= s.length <= 105

  • s?consists only of lowercase English letters.




Runtime:?28 ms, faster than?95.72%?of?Java?online submissions for?Delete Characters to Make Fancy String.

Memory Usage:?43 MB, less than?96.15%?of?Java?online submissions for?Delete Characters to Make Fancy String.


leetcode1957. Delete Characters to Make Fancy String的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
元江| 区。| 平昌县| 长乐市| 修文县| 黄浦区| 贵阳市| 沾益县| 万年县| 平昌县| 咸阳市| 西安市| 北票市| 淄博市| 旬邑县| 苗栗县| 阿图什市| 临海市| 邹城市| 庄浪县| 开远市| 吉水县| 红安县| 长海县| 兴业县| 上蔡县| 宜良县| 株洲县| 柞水县| 奇台县| 云梦县| 延吉市| 龙泉市| 绥芬河市| 汪清县| 清徐县| 方山县| 宁城县| 大荔县| 德庆县| 安阳县|