Problem Statement | |||||||||||||
There are N bottles on a shelf (numbered from 1 to N). Some little kids are playing football near the shelf. Sometimes it happens that their ball hits the shelf and every bottle with an index between left[i] and right[i], inclusive, that is also divisible by damage[i] falls on the ground and breaks. Given N and the arrays left, right and damage. The ball has hit the shelf exactly M times, where M is the size of each of the three arrays. Count and return the number of bottles broken by the kids. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | N will be between 1 and 1,000,000,000, inclusive. | ||||||||||||
- | left, right and damage will each contain between 1 and 18 elements, inclusive. | ||||||||||||
- | left, right and damage will contain the same number of elements. | ||||||||||||
- | Each element of left and right will be between 1 and N, inclusive. | ||||||||||||
- | For each i, left[i] will be less than or equal to right[i]. | ||||||||||||
- | Each element of damage will be between 1 and 42, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
| |||||||||||||
5) | |||||||||||||
|