[JavaScript] 2597. The Number of Beautiful Subsets
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nvar beautifulSubsets = function (A, k) {\n\n  function bt(a) {\n    let n = a.length\n    if (n === 0) return 0\n    let s = 0\n    for (let i = 0; i < n; i++) {\n      let b = []\n      for (let j = i + 1; j < n; j++) {\n        if (Math.abs(a[i] - a[j]) !== k) {\n          b.push(a[j])\n        }\n      }\n      s += 1 + bt(b)\n    }\n    return s\n  }\n\n  let s = bt(A)\n  return s\n};\n\n```
['JavaScript']