Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of K-Free Subsets

Try to solve the Count the Number of K-Free Subsets problem.

Statement

You are given an array of unique positive integers nums and a positive integer k.

A subset of nums is called kk free if it does not contain any pair of elements with an absolute difference equal to k.

Return the total number of kk free subsets of nums.

Note: The empty set is considered a valid subset.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 1≤1 \leq nums[i] ≤1000\leq 1000

  • 1≤1 \leq k ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of K-Free Subsets

Try to solve the Count the Number of K-Free Subsets problem.

Statement

You are given an array of unique positive integers nums and a positive integer k.

A subset of nums is called kk free if it does not contain any pair of elements with an absolute difference equal to k.

Return the total number of kk free subsets of nums.

Note: The empty set is considered a valid subset.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 1≤1 \leq nums[i] ≤1000\leq 1000

  • 1≤1 \leq k ≤1000\leq 1000