JAVA_LeetCode 1869_Longer Contiguous Segments of Ones than Zeros 풀이 class Solution { public boolean checkZeroOnes(String s) { int num1 = 0, num2 = 0, max1 = 0, max2 = 0; // 1, 0에 맞춰서 연속 세그먼트를 계산한다. for (int i : s.toCharArray()) { if (i == '0'){ num1 = 0; if(++num2 > max1){ max1 = num2; } }else{ num2 = 0; if(++num1 > max2){ max2 = num1; } } } return max2 > max1; } } * 출처 https://leetcode.com/problems/longer-contiguous-segments-of-ones-than-zeros...
#
JAVA
#
JAVA_LeetCode1869
#
JAVA_LeetCode1869_LongerContiguousSegmentsofOnesthanZeros
#
JAVA_LongerContiguousSegmentsofOnesthanZeros
#
LeetCode1869_LongerContiguousSegmentsofOnesthanZeros