PROGRAMMERS 12899: 124 나라의 숫자 Link : programmers.co.kr/learn/courses/30/lessons/12899 Python 더보기 1 2 3 4 5 6 7 def solution(n): arr = ['4', '1', '2'] result = '' while n != 0: result = arr[n % 3] + result n = n // 3 - (n % 3 == 0) return result cs FeedBack cjw.git@gmail.com 2021. 1. 11. PROGRAMMERS 42587: 프린터 Link : programmers.co.kr/learn/courses/30/lessons/42587 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 def solution(priorities, location): stack = [] for idx, val in enumerate(priorities): priorities[idx] = [idx, val] while len(priorities): value = priorities.pop(0) for i in priorities: if value[1] 2021. 1. 9. PROGRAMMERS 12953: N개의 최소공배수 Link : programmers.co.kr/learn/courses/30/lessons/12953 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 def solution(arr): arr.sort() stack = [] max_value = arr[-1] while True: status = False for i in range(2,max_value + 1): for item in range(len(arr)): if arr[item] % i == 0: arr[item] //= i status = True if status: stack.append(i) break if not status: break total = 1 for i in s.. 2021. 1. 6. PROGRAMMERS 68645: 삼각 달팽이 Link : programmers.co.kr/learn/courses/30/lessons/68645 Programming Language 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 def solution(n): answer = [[0 for _ in range(n)] for _ in range(n)] dir_value = 0 counting = 1 pos = [0, 0] # x, y for i in range(n, 0, -1): for j in range(i): if dir_value % 3 == 0: # down answer[pos[1]][pos[0]] = counti.. 2021. 1. 6. PROGRAMMERS 49993: 스킬트리 Link : programmers.co.kr/learn/courses/30/lessons/49993 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 def solution(skill, skill_trees): skill_data = dict() counter = 0 for i in range(len(skill) - 1, 0, -1): skill_data[skill[i]] = skill[i - 1] for data in skill_trees: stack = [] for i in data: if i in skill_data: if skill_data[i] in stack: stack.append(i) else: break else: stack.append(.. 2021. 1. 6. 이전 1 ··· 5 6 7 8 9 10 11 ··· 17 다음