File tree 1 file changed +0
-23
lines changed
src/main/java/com/fishercoder/solutions
1 file changed +0
-23
lines changed Original file line number Diff line number Diff line change 1
1
package com .fishercoder .solutions ;
2
2
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
- * */
26
3
public class _1180 {
27
4
public static class Solution1 {
28
5
public int countLetters (String S ) {
You can’t perform that action at this time.
0 commit comments