国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(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ó)家法律
龙游县| 潞西市| 安吉县| 东乡| 秭归县| 寿光市| 湖北省| 台山市| 梁平县| 南阳市| 南丰县| 浦东新区| 松原市| 阜平县| 康马县| 东莞市| 兰考县| 开原市| 萨迦县| 平潭县| 吐鲁番市| 恩施市| 泰州市| 醴陵市| 宜都市| 大理市| 监利县| 浮山县| 麻栗坡县| 沾益县| 连南| 股票| 北辰区| 比如县| 蓬莱市| 磐石市| 舞阳县| 新宁县| 鄂伦春自治旗| 林口县| 兰溪市|