Why isn't DP and TC of O(n^2) working under these constraints? Can someone explain please?
\nclass Solution {\npublic:\n    int solve(vector<int>& nums) {\n        int n = nums.size();\n        if(n == 0) return 0;\n        if(n == 1) return max(0, nu
```\nclass Solution {\npublic:\n    int solve(vector<int>& nums) {\n        int n = nums.size();\n        if(n == 0) return 0;\n        if(n == 1) return max(0, nums[0]);\n        int prev2 = max(0, nums[0]);\n        int prev1 = max(prev2, nums[1]);\n        for(int i=2; i<n; i++) {\n            int current = max(prev1, nums[i] + prev2);\n            prev2 = prev1;\n            prev1 = current;\n        }\n        return prev1;\n    }\n    int maximumSumSubsequence(vector<int>& nums, vector<vector<int>>& queries) {\n        int MOD = 1e9 + 7;\n        long long ans = 0;\n        for(auto query : queries) {\n            int pos = query[0];\n            int xi = query[1];\n            nums[pos] = xi;\n            ans += solve(nums);\n            ans %= MOD;\n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'C']