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

JAVA_LeetCode 2283_Check if Number Has Equal Digit Count and Digit Value

 JAVA_LeetCode 2283_Check if Number Has Equal Digit Count and Digit Value

JAVA_LeetCode 2283_Check if Number Has Equal Digit Count and Digit Value 풀이 class Solution { public boolean digitCount(String num) { // 인덱스에 맞는 개수를 더한다음, 순차적으로 개수와 값이 동일한지 확인한다. int arr[] = new int[10]; for(char ch : num.toCharArray()) arr[ch - '0']++; for(int i = 0; i < num.length(); i++){ if(num.charAt(i) - '0' != arr[i]) return false; } return true; } } * 출처 https://leetcode.com/problems/check-if-number-has-equal-digit-count-and-digit-value...

# JAVA # JAVA_CheckifNumberHasEqualDigitCountandDigitValue # JAVA_LeetCode2283 # LeetCode2283_CheckifNumberHasEqualDigitCountandDigitValue # JAVA_LeetCode2283_CheckifNumberHasEqualDigitCountandDigitValue