Problem Statement |
| | You have k objects divided evenly into num
piles. Unfortunately, some of the digits of k may have been erased
(replaced with 'X's in the input).
Return the number of possible values that k could have been.
|
| |
Definition |
| | | Class: | DigitFiller | | Method: | howMany | | Parameters: | String, int | | Returns: | long | | Method signature: | long howMany(String k, int num) | | (be sure your method is public) |
|
| |
|
| |
Constraints |
| - | k will contain between 2 and 18 characters inclusive. |
| - | Each character in k will be a digit ('0'-'9') or 'X'. |
| - | Character 0 of k will be a positive digit ('1'-'9'). |
| - | num will be between 1 and 10000 inclusive. |
| - | The return value will be at least 1. |
| |
Examples |
| 0) | |
| | | Returns: 1 | | Since the objects are divided evenly into 9 piles, 81 is the only possible solution. |
|
|
| 1) | |
| | | Returns: 10 | | Here there are 10 possible values k could have been. |
|
|
| 2) | |
| | | Returns: 1 | | None of the digits are missing. |
|
|
| 3) | |
| | |
| 4) | |
| | |