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

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

LeetCode 1759. Count Number of Homogenous Substrings

2023-05-26 16:34 作者:您是打尖兒還是住店呢  | 我要投稿

Given a string?s, return?the number of?homogenous?substrings of?s.?Since the answer may be too large, return it?modulo?109?+ 7.

A string is?homogenous?if all the characters of the string are the same.

A?substring?is a contiguous sequence of characters within a string.

?

Example 1:

Input: s = "abbcccaa"Output: 13Explanation: The homogenous substrings are listed as below: "a" ? appears 3 times. "aa" ?appears 1 time. "b" ? appears 2 times. "bb" ?appears 1 time. "c" ? appears 3 times. "cc" ?appears 2 times. "ccc" appears 1 time. 3 + 1 + 2 + 1 + 3 + 2 + 1 = 13.

Example 2:

Input: s = "xy"Output: 2Explanation: The homogenous substrings are "x" and "y".

Example 3:

Input: s = "zzzzz"Output: 15

?

Constraints:

  • 1 <= s.length <= 105

  • s?consists of lowercase letters.

math:

Runtime:?15 ms, faster than?62.58%?of?Java?online submissions for?Count Number of Homogenous Substrings.

Memory Usage:?44.7 MB, less than?5.81%?of?Java?online submissions for?Count Number of Homogenous Substrings.


LeetCode 1759. Count Number of Homogenous Substrings的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
牟定县| 海城市| 阳高县| 阿坝| 恩施市| 齐河县| 夏邑县| 高邮市| 皋兰县| 江城| 疏勒县| 开远市| 遵义县| 全州县| 神农架林区| 吉木乃县| 三原县| 博白县| 义马市| 新安县| 泰来县| 屏边| 崇明县| 武安市| 三门峡市| 工布江达县| 马龙县| 潮安县| 德安县| 阳泉市| 清水县| 沙湾县| 山东| 乾安县| 池州市| 原阳县| 郧西县| 乌拉特中旗| 光山县| 衡山县| 玛纳斯县|