Skip to content

Commit a087a55

Browse files
refactor 696
1 parent 35f4fe8 commit a087a55

File tree

1 file changed

+0
-27
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-27
lines changed

src/main/java/com/fishercoder/solutions/_696.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
11
package com.fishercoder.solutions;
22

3-
/**
4-
* 696. Count Binary Substrings
5-
*
6-
* Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's,
7-
* and all the 0's and all the 1's in these substrings are grouped consecutively.
8-
* Substrings that occur multiple times are counted the number of times they occur.
9-
10-
Example 1:
11-
12-
Input: "00110011"
13-
Output: 6
14-
Explanation: There are 6 substrings that have equal number of consecutive 1's and 0's: "0011", "01", "1100", "10", "0011", and "01".
15-
16-
Notice that some of these substrings repeat and are counted the number of times they occur.
17-
18-
Also, "00110011" is not a valid substring because all the 0's (and 1's) are not grouped together.
19-
20-
Example 2:
21-
22-
Input: "10101"
23-
Output: 4
24-
Explanation: There are 4 substrings: "10", "01", "10", "01" that have equal number of consecutive 1's and 0's.
25-
26-
Note:
27-
s.length will be between 1 and 50,000.
28-
s will only consist of "0" or "1" characters.
29-
*/
303
public class _696 {
314
public static class Solution1 {
325
public int countBinarySubstrings(String s) {

0 commit comments

Comments
 (0)