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

JAVA_LeetCode 2325_Decode the Message

 JAVA_LeetCode 2325_Decode the Message

JAVA_LeetCode 2325_Decode the Message 풀이 class Solution { public String decodeMessage(String key, String message) { // map에 문자별 값을 세팅한다음, message에서 해당 문자를 찾아서 이어붙인다. StringBuilder sb = new StringBuilder(); HashMap map = new HashMap(); key = key.replace(" ",""); char str = 'a'; for(char ch : key.toCharArray()){ if(!

map.containsKey(ch)) map.put(ch, str++); } for(char ch : message.toCharArray()){ if(!map.containsKey(ch)) sb.append(ch); else sb.append(map.get(ch)); } return s...

# JAVA # JAVA_DecodetheMessage # JAVA_LeetCode2325 # JAVA_LeetCode2325_DecodetheMessage # LeetCode2325_DecodetheMessage