You are given an integer array differences of length n, and two integers lower and upper. A hidden integer array hidden of length n + 1 is considered valid if it satisfies both conditions:
The value at each index stays within the inclusive range from lower to upper.
For every index i in the range from differences, meaning hidden[i + 1] - hidden[i] == differences[i].
Return the number of distinct valid arrays hidden that can be formed.
Constraints:
n == differences.length
n
differences[i]
lower upper
You are given an integer array differences of length n, and two integers lower and upper. A hidden integer array hidden of length n + 1 is considered valid if it satisfies both conditions:
The value at each index stays within the inclusive range from lower to upper.
For every index i in the range from differences, meaning hidden[i + 1] - hidden[i] == differences[i].
Return the number of distinct valid arrays hidden that can be formed.
Constraints:
n == differences.length
n
differences[i]
lower upper