← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Two arrays are called analogous if their difference sequences are identical. Given an array of integers called differences and two integers lower and upper, count how many different arrays of length len(differences)+1 exist such that every element lies in the inclusive range [lower, upper] and the difference between each pair of consecutive elements matches the given differences array. In other words, if the output array is A, then for every index i (0-based) A[i+1] - A[i] must equal differences[i]. Return the count modulo 1,000,000,007.