NeetCode #509LC-2597MediumBacktracking
← Back to All Problems#509 · #2597 · The Number of Beautiful Subsets(美丽子集的数目)
📌 Problem Statement & Constraints
You are given an array
nums of positive integers and a positive integer k. A subset is beautiful if it contains no two elements whose absolute difference is k. Return the number of non-empty beautiful subsets. Constraints: 1 <= nums.length <= 20, 1 <= nums[i], k <= 1000.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!