Problem Statement | |||||||||||||
| You are opening a new hotel and are in the process of numbering the rooms. Being a superstitious person, you don't want to allow certain numbers. You are given an int[] notAllowed containing an encoded list of forbidden sequences. The ith forbidden sequence (where i is a 0-based index) is the concatenation of decimal representations of i and notAllowed[i] (both with no extra leading zeros). For example, if the 0th element of notAllowed is 33, then "033" is a forbidden sequence. A room number is not allowed if its decimal string representation, with no extra leading zeroes, contains any of the forbidden sequences as a substring. Given an int roomNumber, return "YES" if the room number is allowed, and "NO" otherwise (all quotes for clarity). | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
| - | notAllowed will contain between 0 and 50 elements, inclusive. | ||||||||||||
| - | Each element of notAllowed will be between 0 and 10000000, inclusive. | ||||||||||||
| - | roomNumber will be between 0 and 10000000, inclusive. | ||||||||||||
Examples | |||||||||||||
| 0) | |||||||||||||
| |||||||||||||
| 1) | |||||||||||||
| |||||||||||||
| 2) | |||||||||||||
| |||||||||||||
| 3) | |||||||||||||
| |||||||||||||
| 4) | |||||||||||||
| |||||||||||||
| 5) | |||||||||||||
| |||||||||||||
| 6) | |||||||||||||
| |||||||||||||