Problem Statement
Return the number of positive integers that are multiples of each number in divisors and divisors of each number in multiples.
Definition
- Class:
- FactoVisors
- Method:
- getNum
- Parameters:
- int[], int[]
- Returns:
- int
- Method signature:
- int getNum(int[] divisors, int[] multiples)
- (be sure your method is public)
Constraints
- divisors and multiples will each contain between 1 and 50 elements, inclusive.
- Each element of divisors and multiples will be between 1 and 10^9, inclusive.
Examples
{1}{100}Returns: 9
The working integers are 1, 2, 4, 5, 10, 20, 25, 50, and 100.{6,9}{18}Returns: 1
18 is the only integer that works.{6,9}{96,180}Returns: 0
No integers work.{2,4}{256}Returns: 7
{1000,10000,100000}{1000000000}Returns: 25
Beware of overflow.