simple dp with constant optimization beats 100% java solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\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    public int maximumSumSubsequence(int[] nums, int[][] queries) {\n        int[] dp = new int[nums.length];\n        int ans = 0;\n        for (int i = 0; i < queries.length; ++i) {\n            int[] query = queries[i];\n            nums[query[0]] = query[1];\n            int start = 1;\n            if (i != 0) {\n                start = query[0];\n            }\n            dp[0] = Math.max(0, nums[0]);\n            for (int j = start; j < nums.length; j++) {\n                    if (j == 0) {\n                        continue;\n                    }\n                    dp[j] = Math.max(nums[j], dp[j - 1]);\n                    if (j > 1) {\n                        dp[j] = Math.max(dp[j], nums[j] + dp[j - 2]);\n                    }\n            }\n            ans = (ans + dp[nums.length - 1]) % 1000000007;\n        }\n        return ans;\n    }\n}\n```
['Java']