Back to problems

All Subsets with a Given Sum

Algorithm · Apple · Medium

All Subsets Summing to a Target Medium · Backtracking · Company Tags · Hints You are given a collection of $$n$$ distinct positive integers and a target sum $$target$$. Your task is to list every subset of the given integers whose elements add up exactly to $$target$$. Each element may be chosen at most once. You must implement the solution using backtracking and analyze its time complexity as $$O(2^n)$$ as well as its space complexity (including recursion stack and storage…

Checking your access…