def solution(skill, skill_trees):
answer = 0
for skill_tree in skill_trees:
skill_t = [ s for s in skill_tree if s in skill]
skt = ''.join(skill_t)
if skill.find(skt) == 0: answer += 1
return answer
import re
def solution(files):
reg = [re.split(r'(\d+)', s) for s in files]
reg.sort(key = lambda x: (x[0].lower(), int(x[1])))
return [''.join(s) for s in reg]
def solution(msg):
dic = {}
for i in range(26):
dic[chr(65+i)] = i+1
w = 0
c = 0
answer = []
while True:
c += 1
if len(msg) == c:
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
def solution(board):
for i in range(1, len(board)):
for j in range(1, len(board[i])):
if board[i][j] == 1:
board[i][j] = min(board[i-1][j-1], board[i-1][j], board[i][j-1]) + 1
# print(board)
answer = 0
for b in board:
lmax = max(b)
answer = max(answer, lmax)
return answer**2
def n_decimal(n, q):
base = "0123456789ABCDEF" # 나올 수 있는 값
n, mod = divmod(n, q)
if n == 0:
return base[mod]
return n_decimal(n, q) + base[mod] # 나머지 index를 이용하여 string 더하기
def solution(n, t, m, p):
answer = ''
temp = ''
for i in range(m * t): # 나올 수 있는 모든 string 개수 = m 명 * t 개
temp += n_decimal(i, n)
while len(answer) < t:
answer += temp[p-1]
p += m # m 명 다 돌고 튜브의 순서가 돌아옴
return answer