Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- GIT
- leetcode
- 프로그래머스
- GitHub Action
- NLP
- FastAPI
- pep8
- 백준
- pytorch
- wandb
- autoencoder
- vscode
- github
- Kaggle
- Matplotlib
- GCP
- NaverAItech
- torchserve
- docker
- 네이버AItech
- rnn
- FDS
- 완전탐색
- 코딩테스트
- DeepLearning
- python
- PytorchLightning
- Kubernetes
- datascience
- 알고리즘
Archives
- Today
- Total
Sangmun
백트래킹을 이용한 부분 집합을 구하는 알고리즘 본문
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
a_list = list(map(int,input().split()))
total_result = []
result = []
def BT(depth):
if depth == n:
total_result.append(result.copy())
return
result.append(a_list[depth])
BT(depth+1)
result.pop()
BT(depth+1)
BT(0)
print(total_result)
'알고리즘 > 알고리즘(초급)' 카테고리의 다른 글
python 으로 stack 직접 구현하기 (0) | 2022.12.04 |
---|---|
투포인터 (0) | 2022.11.23 |
유클리드 호제법(최대공약수), 최소공배수 (0) | 2022.11.18 |
에라토스테네스의 체 (0) | 2022.11.17 |
배수와 약수 (0) | 2022.08.17 |
Comments