Java || Recursion&Memo|| Subsequence logic (Explained) || Passes 45/62(TLE)
```\nclass Solution {\n    private static final int MOD = (int) (1e9 + 7);\n\n    public int numSubseq(int[] nums, int target) {\n        Arrays.sort(nums);\n  
```\nclass Solution {\n    private static final int MOD = (int) (1e9 + 7);\n\n    public int numSubseq(int[] nums, int target) {\n        Arrays.sort(nums);\n        Map<String, Integer> memo = new HashMap<>();\n        long ans = helper(nums, Integer.MAX_VALUE, Integer.MIN_VALUE, 0, target, memo);\n        return (int) (ans % MOD);\n    }\n\n    public long helper(int[] nums, long min, long max, int i, int target, Map<String, Integer> memo) {\n        if (i >= nums.length)\n            return 0;\n      // memoization \n        String key = i + "#" + min + "#" + max;\n        if (memo.containsKey(key))\n            return memo.get(key);\n\n        long max1 = max;\n        long min1 = min;\n        if (nums[i] > max1) {\n            max1 = nums[i];\n        }\n\n        if (nums[i] < min1) {\n            min1 = nums[i];\n        }\n\n        long sum = min1 + max1;\n\n        long count = 0;\n// we return 0 as all number are sorted hence later we only get much larger number so no point in checking further \n        if (sum > target)\n            return 0;\n//**take \n        else {\n\t\t// we have updated the max and min with max1 and min1 hence we are including this number in subsequence \n            count = 1 + helper(nums, min1, max1, i + 1, target, memo);\n        }\n\t\t// **notTake\n// this call is when we are ignoring this number and moving forward hence max and min are same \n        count += helper(nums, min, max, i + 1, target, memo);\n\n        memo.put(key, (int) (count % MOD));\n        return count;\n    }\n}\n\n// i think we can ignore duplicates and optiize this more, feel free to add in comments
['Recursion', 'Java']