Problem Statement | |||||||||||||
You want to see some page on the teletext (information service on TV where we refer to pages of information by numbers). Unfortunately, some of the digit buttons on the remote control are broken. But you have an idea! If you can't enter the number of the page you want to see, you could enter some other number and with the buttons '+' and '-' (which are not broken) navigate to the desired page. Button '+' increases the number by 1 and button '-' decreases the number by 1. You are initially at page 100. To go to a different page, you may enter the page number using the digit buttons that aren't broken. Then, press the '+' and '-' buttons to navigate to your desired page. You will be given an int page, the page you want to see, and a int[] broken, the list of broken digit buttons. Return the minimum number of button presses required to navigate to the page. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | page will be between 0 and 500,000, inclusive. | ||||||||||||
- | broken will contain between 0 and 10 elements, inclusive. | ||||||||||||
- | Each element of broken will be between 0 and 9, inclusive. | ||||||||||||
- | All elements of broken will be distinct. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|