Company: NXT wave_18oct
Difficulty: medium
Dynamic Range Scoring in a Modified Array Problem Description You're given a 0-indexed array of positive integers nums and an integer k . Work out the highest score obtainable from a subarray that is allowed to be modified and that must contain index k . How the score is computed: The score of a subarray (i, j) equals the dynamic minimum across nums[i] through nums[j] , multiplied by the running total of a second array scores , which starts out all zeros and is the same length as nums . The "dynamic minimum" is whatever the smallest value in the subarray happens to be after every modification made so far has been applied. On the subarray (i, j) you may carry out any of the following moves, up to M moves total: i. Increment: raise one element of the subarray by 1. ii. Decrement: lower one element of the subarray by 1, never going below 1. iii. Score Update: whenever a move is made, add 1 to the scores entry at the position that was changed. Find the best score achievable over any subarr