Java | Two pointers | Beats 100% | 15 lines
Complexity\n- Time complexity: O(n*log(n))\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(n)\n Add your space complexity here, e.g. O(n) \
# Complexity\n- Time complexity: $$O(n*log(n))$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n  public int numSubseq(int[] nums, int target) {\n    var n = nums.length;\n    Arrays.sort(nums);\n\n    var exp = new int[n];\n    exp[0] = 1;\n\n    for (var i=1; i<n; i++)\n      exp[i] = (exp[i-1] * 2) % 1000000007;\n\n    int i = 0, j = n-1, cnt = 0;\n\n    while (i <= j) {\n      if (nums[i] + nums[j] <= target) {\n        cnt = (cnt + exp[j-i]) % 1000000007;\n        i++;\n      } else {\n        j--;\n      }\n    }\n    return cnt;\n  }\n}\n```\nIf you like my solution, please upvote it!
['Array', 'Two Pointers', 'Sorting', 'Java']