목록순열 (2)
황소개발자
python permutations combinations 파이썬 순열 조합 itertools 모듈 사용. 사용법 정리. 문제점과 한계. 그리고 해결책
입력이 들어오는 방식은 두가지 1. 문자열 import itertools a = '1234' print(list(map(''.join, itertools.permutations(a)))) ['1234', '1243', '1324', '1342', '1423', '1432', '2134', '2143', '2314', '2341', '2413', '2431', '3124', '3142', '3214', '3241', '3412', '3421', '4123', '4132', '4213', '4231', '4312', '4321'] 2. 숫자 배열 (문자 배열은 그냥 map(str, a) 없이 해주면 됨) import itertools a = [1, 2, 3, 4] print(list(itertools.per..
백준 문제 풀이
2020. 4. 22. 21:29