Increasing Subsequences LeetCode solution in JavaScript
1var findSubsequences = function (nums) {2const result = [];3const set = new Set();45function bt(index = 0, ar = []) {6if (!set.has(ar.join("_")) && ar.length >= 2) {7set.add(ar.join("_"));8result.push(ar);9}10for (let i = index; i < nums.length; i++) {11if (nums[i] >= ar[ar.length - 1] || ar.length === 0) {12bt(i + 1, [...ar, nums[i]]);13}14}15}1617bt();18return result;19};