로딩
요청 처리 중입니다...

JAVA_Count Binary Substrings_LeetCode 696

 JAVA_Count Binary Substrings_LeetCode 696

JAVA_Count Binary Substrings_LeetCode 696 풀이 class Solution { public int countBinarySubstrings(String s) { int num1 = 1, num2 = 0, cnt = 0; for (int i = 1; i < s.length(); i++) { if (s.charAt(i) == s.charAt(i - 1)){ num1++; } else { cnt += Math.min(num1, num2); num2 = num1; num1 = 1; } } return cnt + Math.min(num1, num2); } } * 출처 Count Binary Substrings - LeetCode Count Binary Substrings - Given a binary string s, return the number of non-empty substrings that have the same number of 0's and 1'...

# CountBinarySubstrings_LeetCode696 # JAVA # JAVA_CountBinarySubstrings # JAVA_CountBinarySubstrings_LeetCode696 # JAVA_LeetCode696