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 | 29 | 30 | 31 |
Tags
- autoencoder
- GIT
- 완전탐색
- 네이버AItech
- 백준
- pep8
- NaverAItech
- FastAPI
- wandb
- PytorchLightning
- GCP
- 알고리즘
- FDS
- NLP
- Kubernetes
- GitHub Action
- python
- Matplotlib
- 코딩테스트
- vscode
- rnn
- 프로그래머스
- pytorch
- Kaggle
- docker
- github
- leetcode
- DeepLearning
- datascience
- torchserve
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 |