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

歡迎光臨散文網(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ó)家法律
海盐县| 五大连池市| 西昌市| 镇赉县| 吴旗县| 石屏县| 定边县| 珠海市| 屯昌县| 馆陶县| 平定县| 肃宁县| 大同县| 阿拉尔市| 石泉县| 台江县| 策勒县| 边坝县| 玛纳斯县| 千阳县| 广水市| 崇明县| 花莲市| 河北区| 布拖县| 大港区| 舒城县| 高雄市| 抚宁县| 襄垣县| 祁阳县| 石柱| 平远县| 虎林市| 垫江县| 阳城县| 龙川县| 曲松县| 湄潭县| 万安县| 铜川市|