class Solution{ static Boolean isSubsetSum(int N, int arr[]){ // code here ArrayList<ArrayList<Integer>> res = new ArrayList<>();// this is for storing result find(0,arr,new ArrayList<Integer>() , res); } static void find(int idx ,int[] arr , ArrayList<Integer> cur, ArrayList<ArrayList<Integer>> res){ res.add(new ArrayList<>(cur)); for(int i=idx;i<arr.length;i++){ cur.add(arr[i]); find(i+1,arr, cur , res); cur.remove(cur.get(cur.size()-1)); } } }
Comments
Post a Comment