Tap here to switch tabs
Problem
Submissions

Problem: Find K-Sum Subsets

Find K-Sum Subsets asks you to return every subset of distinct positive integers whose elements add up to a given target value.

Statement

Given an array of nn distinct positive integers, find all possible subsets of these integers such that the sum of the elements in each subset equals a given target value k.

Return a 2D array, where each inner array represents a subset whose sum equals k.

Constraints:

  • 1≤n≤101 \leq n \leq 10

  • 1≤x≤1001 \leq x \leq 100, where xx is any member of the input array.

  • 1≤1 \leq k ≤103\leq 10^3

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find K-Sum Subsets

Find K-Sum Subsets asks you to return every subset of distinct positive integers whose elements add up to a given target value.

Statement

Given an array of nn distinct positive integers, find all possible subsets of these integers such that the sum of the elements in each subset equals a given target value k.

Return a 2D array, where each inner array represents a subset whose sum equals k.

Constraints:

  • 1≤n≤101 \leq n \leq 10

  • 1≤x≤1001 \leq x \leq 100, where xx is any member of the input array.

  • 1≤1 \leq k ≤103\leq 10^3