You are given an integer array nums and a queries, where each queries[i] = [pos_i, x_i].
For each query, perform the following operations:
Update nums[pos_i] to x_i.
Compute the maximum sum of a subsequence of nums such that no two selected elements are adjacent.
Return the sum of the answers to all queries. Since the answer may be very large, return it modulo
Note: An empty subsequence is considered valid and has a sum of
.
Constraints:
nums.length
nums[i]
queries.length
queries[i] == [pos_i, x_i]
pos_i nums.length
x_i
You are given an integer array nums and a queries, where each queries[i] = [pos_i, x_i].
For each query, perform the following operations:
Update nums[pos_i] to x_i.
Compute the maximum sum of a subsequence of nums such that no two selected elements are adjacent.
Return the sum of the answers to all queries. Since the answer may be very large, return it modulo
Note: An empty subsequence is considered valid and has a sum of
.
Constraints:
nums.length
nums[i]
queries.length
queries[i] == [pos_i, x_i]
pos_i nums.length
x_i