Problem Statement | |||||||||||||
You will be given a list of patterns. Each pattern will contain only digits ('0'-'9'), question marks ('?'), and may potentially begin or end (but not both) with a hyphen ('-'). You must return the number of strings of length len that match all of the patterns. A digit must be matched with the same digit. A question mark can be matched with any digit. If the pattern ends with a hyphen, the pattern is describing a prefix. Similarly, if the pattern begins with a hyphen it describes a suffix. If there are no hyphens, the matched string must have the same length as the pattern. Said differently, a hyphen matches 0 or more digits. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | patterns will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of patterns will contain between 1 and 50 characters, inclusive. | ||||||||||||
- | Each character in patterns will be a digit ('0'-'9'), a question mark ('?'), or a hyphen ('-'); | ||||||||||||
- | Each element of patterns will contain at most 1 hyphen, and it must occur at the beginning or the end of the element. | ||||||||||||
- | len will be between 1 and 50, inclusive. | ||||||||||||
- | The return value will be between 0 and 1,000,000,000, inclusive. | ||||||||||||
- | No element of patterns will be "-" (quotes for clarity). | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
| |||||||||||||
5) | |||||||||||||
|