Problem Statement
A number is a multi number if its decimal representation can be split into two numbers, such that the product of all the digits in the first number is equal to the product of all the digits in the second number. For example, 1221 is a multi number because it can be split into 12 and 21, and 1 * 2 = 2 * 1. 1236 is also a multi number, but 1234 is not. Note that you can only split a number into two sequences of consecutive digits, where each sequence contains at least one digit. So, for example, we can only split 12345 in four different ways: 1-2345, 12-345, 123-45, 1234-5. You will be given an int number. Return "YES" if it is a multi number, or "NO" otherwise (all quotes for clarity).
Definition
- Class:
- MultiNumber
- Method:
- check
- Parameters:
- int
- Returns:
- String
- Method signature:
- String check(int number)
- (be sure your method is public)
Constraints
- number will be between 1 and 2,147,483,647, inclusive.
Examples
1
Returns: "NO"
Note that all single-digit numbers are not multi numbers. That's because they cannot be split into two non-empty parts.1221
Returns: "YES"
Example from the problem statement.1236
Returns: "YES"
4729382
Returns: "NO"
42393338
Returns: "YES"