PLEASE HELP
Intuition\nPlease explain why my solution doesn\'t pass\nI get MLE but it\'s O(n*m)\ntried bottom up and such but TLE\n\n:((((\n\n# Approach\nhttps://tenor.com/
# Intuition\nPlease explain why my solution doesn\'t pass\nI get MLE but it\'s O(n*m)\ntried bottom up and such but TLE\n\n:((((\n\n# Approach\nhttps://tenor.com/view/head-hammer-time-hit-cartoon-gif-19504884\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def countOfPairs(self, nums: List[int]) -> int:\n        MOD = 10**9+7\n\n        cache = {}\n        def recurs(index, curr_num_arr1):\n            if index == len(nums):\n                return 1\n            \n            if (index, curr_num_arr1) in cache:\n                return cache[(index, curr_num_arr1)]\n\n            curr_num_arr2 = nums[index] - curr_num_arr1\n            if curr_num_arr2 < 0:\n                return 0\n\n            next_min_num1 = nums[index+1] - curr_num_arr2 if index+1 < len(nums) else -1\n            res = recurs(index, curr_num_arr1+1) + recurs(index+1, max(curr_num_arr1, next_min_num1))\n            res %= MOD\n            \n            cache[(index, curr_num_arr1)] = res\n            return res\n        \n        return recurs(0, 0)\n\n\n```
['Python3']