[Python : 프로그래머스] 2016년
문제 https://programmers.co.kr/learn/courses/30/lessons/12901 풀이 def solution(a, b): week = ["THU", "FRI", "SAT", "SUN", "MON", "TUE", "WED"] month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] ...
[Python : 프로그래머스] 타겟 넘버
문제 https://programmers.co.kr/learn/courses/30/lessons/43165 풀이 def solution(numbers, target): from itertools import product pm = [(num, -num) for num in numbers] answer = list(map(sum, product(*pm)...
[Python : 프로그래머스] 카펫
문제 https://programmers.co.kr/learn/courses/30/lessons/42842?language=python3 풀이 def solution(brown, yellow): total = brown + yellow cd = [i for i in range(2,total) if total % i == 0] if len(cd) % 2...
[Python : 프로그래머스] 네트워크
문제 https://programmers.co.kr/learn/courses/30/lessons/43162 풀이 DFS로 경로가 몇 개인지 찾는 문제 보통 DFS가 무한루프에 빠지지 않도록 방문내역을 확인하는데, 모든 노드에 대해서 방문기록이 있는지 확인하고, 없으면 DFS 진행시키면서 경로개수를 증가시켜서 해결한다. def DFS(i, visited...
[Python : 프로그래머스] 프린터
문제 https://programmers.co.kr/learn/courses/30/lessons/42587?language=python3 풀이 def solution(priorities, location): op = priorities[location] lst = sorted(list(enumerate(priorities)), key=lambda x:...