Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0c5a8ea

Browse files
refactor 1180
1 parent243c381 commit0c5a8ea

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

‎src/main/java/com/fishercoder/solutions/_1180.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,5 @@
11
packagecom.fishercoder.solutions;
22

3-
/**
4-
* 1180. Count Substrings with Only One Distinct Letter
5-
*
6-
* Given a string S, return the number of substrings that have only one distinct letter.
7-
*
8-
* Example 1:
9-
* Input: S = "aaaba"
10-
* Output: 8
11-
* Explanation: The substrings with one distinct letter are "aaa", "aa", "a", "b".
12-
* "aaa" occurs 1 time.
13-
* "aa" occurs 2 times.
14-
* "a" occurs 4 times.
15-
* "b" occurs 1 time.
16-
* So the answer is 1 + 2 + 4 + 1 = 8.
17-
*
18-
* Example 2:
19-
* Input: S = "aaaaaaaaaa"
20-
* Output: 55
21-
*
22-
* Constraints:
23-
* 1 <= S.length <= 1000
24-
* S[i] consists of only lowercase English letters.
25-
* */
263
publicclass_1180 {
274
publicstaticclassSolution1 {
285
publicintcountLetters(StringS) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp