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

JAVA_License Key Formatting_LeetCode 482

 JAVA_License Key Formatting_LeetCode 482

JAVA_License Key Formatting_LeetCode 482 풀이 class Solution { public String licenseKeyFormatting(String s, int k) { StringBuilder sb = new StringBuilder(); for (int i = s.length() - 1; i >= 0; i--) { if (s.charAt(i) != '-') { if (sb.length() % (k + 1) == k) { sb.append('-'); } sb.append(Character.toUpperCase(s.charAt(i))); } } return sb.reverse().toString(); } } * 출처 License Key Formatting - LeetCode License Key Formatting - You are given a license key represented as a string s that consists of o...

# JAVA # JAVA_LeetCode482 # JAVA_LicenseKeyFormatting # JAVA_LicenseKeyFormatting_LeetCode482 # LicenseKeyFormatting_LeetCode482