-
1309. Decrypt String from Alphabet to Integer Mapping javaLeetCode_Study_Plan/Programming Skills 2022. 9. 22. 15:24
https://leetcode.com/problems/decrypt-string-from-alphabet-to-integer-mapping/
class Solution { public String freqAlphabets(String s) { String ans = ""; int index = 0; while(index < s.length()){ if(index < s.length() - 2 && s.charAt(index + 2) == '#'){ int num = Integer.parseInt(s.substring(index, index + 2)); ans += (char)(num + 96); index = index + 3; continue; } ans += (char)(97 + s.charAt(index) - '1'); index++; } return ans; } }
'LeetCode_Study_Plan > Programming Skills' 카테고리의 다른 글
1290. Convert Binary Number in a Linked List to Integer java (0) 2022.09.24 953. Verifying an Alien Dictionary java (0) 2022.09.22 709. To Lower Case java (0) 2022.09.22 [Programming Skills I] 이틀 뒤, 중간 점검 (2) 2022.09.21 389. Find the Difference java (0) 2022.09.21