Problem Statement |
| Let's call a given number cool if its digits can be divided into two sets such that the sum of the digits in one set is equal to the sum of the digits in the other set. For example, the number 242 is cool because we can divide it into sets {2, 2} and {4}, and the sum of the digits in each set is 4. Given two ints A and B, return how many numbers between A and B, inclusive, are cool. |
|
Definition |
| Class: | CoolNumber | Method: | count | Parameters: | int, int | Returns: | int | Method signature: | int count(int A, int B) | (be sure your method is public) |
|
|
|
|
Constraints |
- | A will be between 1 and 109, inclusive. |
- | B will be between A and 109, inclusive. |
- | The difference between B and A will be at most 106. |
|
Examples |
0) | |
| | Returns: 4 | Here we've got following cool numbers: 11, 22, 33, 44. |
|
|
1) | |
| |
2) | |
| |