Count the ways to fill the -1 entries of an array so that local-maximum constraints hold.
Unlock detailed company stats for this questionUpgrade
You are given an array of n elements where some are -1 and others are integers between 1 and 200. Count the ways to replace each -1 with a value between 1 and 200 such that: 1) arr[0] <= arr[1]; 2) arr[n-2] >= arr[n-1]; 3) arr[i] <= max(arr[i-1], arr[i+1]) for all i in [1, n-2]. Constraint: n <= 1e4.
Community answers
No answers contributed by the community yet.


