๐ป Coding Problems Solving/Hash | HashMap
[ํ๋ก๊ทธ๋๋จธ์ค] LV.2 [3์ฐจ] ์์ถ
[ํ๋ก๊ทธ๋๋จธ์ค] LV.2 [3์ฐจ] ์์ถ 1. ๋ฌธ์ : Link 2. ํ์ด : Link 3. ์ฝ๋ def solution(msg): answer = [] dic = {} for i in range(26): dic[chr(65+i)] = i+1 w, c = 0, 0 while True: c += 1 if c == len(msg): answer.append(dic[msg[w:c]]) break if msg[w:c+1] not in dic: dic[msg[w:c+1]] = len(dic) + 1 answer.append(dic[msg[w:c]]) w = c return answer import java.util.*; class Solution { public int[] solution(String msg) { ..
2022. 4. 25. 16:08
์ต๊ทผ๋๊ธ