Simple and Easy 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     int MOD = (int)(Math.pow(10, 9)) + 7;\n\n    public int maximumSumSubsequence(int[] nums, int[][] queries) {\n        int res = 0;\n        for (int i = 0; i < queries.length; i++) {\n            int index = queries[i][0];\n            int value = queries[i][1];\n            nums[index] = value;\n            res = (res + solve(nums)) % MOD;\n        }\n        return res;\n    }\n\n    private int solve(int[] nums) {\n        int n = nums.length;\n        if (n == 0) return 0;\n        if (n == 1) return Math.max(0,nums[0]);\n\n        int[] dp = new int[n];\n\n        dp[0] = Math.max(0, nums[0]);\n        dp[1] = Math.max(dp[0], nums[1]);\n\n        for (int i = 2; i < n; i++) {\n            dp[i] = Math.max(dp[i - 1], nums[i] + dp[i - 2]);\n        }\n\n        return dp[n - 1];\n    }\n}\n\n```
['Dynamic Programming', 'Recursion', 'Java']