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

歡迎光臨散文網(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ó)家法律
丹东市| 龙泉市| 伊吾县| 盐边县| 弥勒县| 师宗县| 山丹县| 波密县| 上林县| 来凤县| 方正县| 济南市| 毕节市| 寿光市| 方正县| 赞皇县| 鹤峰县| 新竹县| 墨脱县| 永寿县| 囊谦县| 灵石县| 仲巴县| 常宁市| 团风县| 南郑县| 贵州省| 扎赉特旗| 南雄市| 图们市| 旬邑县| 河曲县| 甘孜县| 公主岭市| 长岛县| 前郭尔| 南平市| 易门县| 运城市| 临邑县| 会理县|