Closed honeySleepr closed 2 years ago
// 부분집합 구하기(DFS) public class P0706 { private static int[] arr; private static int n = 3; private static StringBuilder sb = new StringBuilder(); public static void main(String[] args) { arr = new int[n + 1]; DFS(1); System.out.println(sb); } private static void DFS(int L) { if (L > n) { for (int i = 1; i < arr.length; i++) { if (arr[i] == 1) { sb.append(i).append(" "); } } sb.append("\n"); return; } arr[L] = 1; DFS(L + 1); arr[L] = 0; DFS(L + 1); } }
📌 문제
⭐️ 아이디어
🤔 고민한 내용
💪 새롭게 배운 내용
🆘 이해가 어려운 내용
❌ 해결하지 못한 이유
✅ 본인 풀이
참고한 자료