JAVA_LeetCode 395_Longest Substring with At Least K Repeating Characters 풀이 class Solution { public int longestSubstring(String s, int k) { // 해당 문제 조건은 인덱스의 연속을 의미한 문제이다. if(s.length() < k) return 0; // 길이가 k보다 짧으면 0 // 문자 빈도 계산 int[] cnt = new int[26]; for(char c : s.toCharArray()) cnt[c - 'a']++; for(int i = 0; i < s.length(); i++){ if(cnt[s.charAt(i) - 'a'] < k){ // 이 문자는 k번 미만 등장 // 해당 문자를 기준으로 좌 / 우 분할 후 각각 가능한 최대 길이를 비교 return Math.max( longestSubstring(s.substring(0, i), k), longestSubst...