#3165

Maximum Sum of Subsequence With Non-adjacent Elements

grandmaster · 2285 · lc hard +32 · 15.5% accepted · 154 likes · top 0%

Description

Given an integer array nums and queries queries[i] = [posi, xi], for each query set nums[posi] = xi and then compute the maximum sum of a non-adjacent subsequence of the updated nums. Return the total of all query answers modulo 109 + 7.

Code

1
2
3