Problem Statement | |||||||||||||
Taro and Hanako have rabbits, and they want to assign a distinct integer to each rabbit so they can easily identify them.
The rabbits have expressed their preferences to Taro and Hanako. The i-th rabbit wants an integer between 1 and maxNumber[i], inclusive. Taro and Hanako must obey the preferences of all their rabbits. Return the number of ways they can assign numbers to their rabbits, modulo 1,000,000,007. If it's impossible to assign distinct integers to the rabbits, return 0. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | maxNumber will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of maxNumber will be between 1 and 1,000, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|