From 6afeddee9b6092a67b8f2c46c2460d858b2102e0 Mon Sep 17 00:00:00 2001 From: Jisan <149364697+kjs254@users.noreply.github.com> Date: Fri, 5 Apr 2024 23:49:51 +0900 Subject: [PATCH 1/2] 2024-04-05 --- ...0\352\262\237 \353\204\230\353\262\204.py" | 23 +++++++++++++++++++ kjs254/README.md | 8 +++---- 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 "kjs254/DFS/\355\203\200\352\262\237 \353\204\230\353\262\204.py" diff --git "a/kjs254/DFS/\355\203\200\352\262\237 \353\204\230\353\262\204.py" "b/kjs254/DFS/\355\203\200\352\262\237 \353\204\230\353\262\204.py" new file mode 100644 index 0000000..8ce9131 --- /dev/null +++ "b/kjs254/DFS/\355\203\200\352\262\237 \353\204\230\353\262\204.py" @@ -0,0 +1,23 @@ +def DFS(length, start, path): + if len(path) > length: + return + idxs_list.append(path) + + for i in range(start, length): + DFS(length, i + 1, path + [i]) + +def solution(numbers, target): + global idxs_list + idxs_list = [] + DFS(len(numbers),0,[]) + my_numbers = [x for x in numbers] + count=0 + + for idx in idxs_list: + for i in idx: + my_numbers[i] *=-1 + if sum(my_numbers)==target: + count+=1 + my_numbers = [x for x in numbers] + + return count \ No newline at end of file diff --git a/kjs254/README.md b/kjs254/README.md index 1dbef24..33e6550 100644 --- a/kjs254/README.md +++ b/kjs254/README.md @@ -1,5 +1,3 @@ -## ✏️ 기록 - | 차시 | 날짜 | 문제유형 | 링크 | 풀이 | |:----:|:---------:|:----:|:-----:|:----:| | 1차시 | 2024.02.12 | 스택 | [기능개발](https://school.programmers.co.kr/learn/courses/30/lessons/42586) | [#2](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/2) | @@ -9,5 +7,7 @@ | 5차시 | 2024.02.24 | DFS | [모음사전](https://school.programmers.co.kr/learn/courses/30/lessons/84512) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/19) | | 6차시 | 2024.02.27 | 스택 | [괄호 회전하기](https://school.programmers.co.kr/learn/courses/30/lessons/76502) | [#22](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/22) | | 7차시 | 2024.03.01 | 구현 | [캐시](https://school.programmers.co.kr/learn/courses/30/lessons/17680) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/24) | -======= ---- \ No newline at end of file +| 8차시 | 2024.03.08 | 구현 | [튜플](https://school.programmers.co.kr/learn/courses/30/lessons/64065) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/30) | +| 9차시 | 2024.03.10 | 구현 | [뉴스 클러스터링](https://school.programmers.co.kr/learn/courses/30/lessons/17677) | [#33](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/33) | +| 10차시 | 2024.04.02 | 해시 | [전화번호 목록](https://school.programmers.co.kr/learn/courses/30/lessons/42577) | [#46](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/46) | +| 11차시 | 2024.04.05 | DFS | [타겟 넘버](https://school.programmers.co.kr/learn/courses/30/lessons/43165) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/46) | \ No newline at end of file From e64a828aed1d837995cc97fd156143b92fa189c5 Mon Sep 17 00:00:00 2001 From: Jisan <149364697+kjs254@users.noreply.github.com> Date: Fri, 5 Apr 2024 23:52:17 +0900 Subject: [PATCH 2/2] Update README.md --- kjs254/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kjs254/README.md b/kjs254/README.md index 33e6550..d619f18 100644 --- a/kjs254/README.md +++ b/kjs254/README.md @@ -10,4 +10,4 @@ | 8차시 | 2024.03.08 | 구현 | [튜플](https://school.programmers.co.kr/learn/courses/30/lessons/64065) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/30) | | 9차시 | 2024.03.10 | 구현 | [뉴스 클러스터링](https://school.programmers.co.kr/learn/courses/30/lessons/17677) | [#33](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/33) | | 10차시 | 2024.04.02 | 해시 | [전화번호 목록](https://school.programmers.co.kr/learn/courses/30/lessons/42577) | [#46](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/46) | -| 11차시 | 2024.04.05 | DFS | [타겟 넘버](https://school.programmers.co.kr/learn/courses/30/lessons/43165) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/46) | \ No newline at end of file +| 11차시 | 2024.04.05 | DFS | [타겟 넘버](https://school.programmers.co.kr/learn/courses/30/lessons/43165) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/47) | \ No newline at end of file