Boring solution with recursion
Intuition\nI\'ll use recursion.\n\n# Complexity\n- Time complexity:\nO(n^2)\n\n- Space complexity:\nO(n)\n\n# Code\n\npublic sealed class Solution \n{\n    publ
# Intuition\nI\'ll use recursion.\n\n# Complexity\n- Time complexity:\n$$O(n^2)$$\n\n- Space complexity:\n$$O(n)$$\n\n# Code\n```\npublic sealed class Solution \n{\n    public int BeautifulSubsets(int[] nums, int k) \n    {\n        var sum = 0;\n        var n = nums.Length;\n\n        Recursion(0, new List<int>());\n\n        return sum;\n\n        void Recursion(int start, List<int> subset)\n        {\n            if (subset.Count > 0) \n            {\n                sum++;\n            }\n\n            for (int i = start; i < n; i++) \n            {\n                var flag = true;\n\n                foreach(var num in subset) \n                {\n                    if (Math.Abs(num - nums[i]) == k) \n                    {\n                        flag = false;\n                        break;\n                    }\n                }\n\n                if (flag) \n                {\n                    subset.Add(nums[i]);\n                    Recursion(i + 1, subset);\n                    subset.Remove(nums[i]);\n                }\n            }\n        }\n    }\n}\n```
['Array', 'Recursion', 'C#']