Beats 100%, check it out.
\n\n# Complexity\n- Time complexity: O(n * log(n)) - Time complexity of this function is dominated by the sorting operation. That is O(n*log n)\n- Space complex
![image.png](https://assets.leetcode.com/users/images/4e95f9f6-a26a-4246-abd6-4bc7b24e2205_1683337946.5098224.png)\n\n# Complexity\n- Time complexity: O(n * log(n)) - Time complexity of this function is dominated by the sorting operation. That is O(n*log n)\n- Space complexity: O(n) - array `arr` is created with `n` elements, where `n` is the length of the input `nums`. \n\n# Code\n```\n/**\n * @param {number[]} nums\n * @param {number} target\n * @return {number}\n */\n    \nvar numSubseq = function(nums, target) \n{\n    const mod = 1000000007, arr = [];\n    let num = 1;\n\n    for (let i = 0; i < nums.length; i++) \n    {\n        arr.push(num);\n        num = num * 2 % mod;\n    }\n\n    nums.sort((a,b) => a - b);\n\n    let count = 0, j = nums.length - 1;\n\n    for (let i = 0; i < nums.length && nums[i]*2 <= target; i++) \n    {\n        while (j && nums[j] + nums[i] > target) \n        j--;\n\n        count = (count + arr[j - i])%mod;\n    }\n    return count;\n};\n```
['JavaScript']