Problem Statement | |||||||||||||
You are given a set of integers called luckySet. An interval [A,B], where B is greater than A, and A and B are positive integers, is considered unlucky if none of the integers between A and B, inclusive, belongs to luckySet. Given a int[] luckySet and a int n that is not greater than the maximum element in luckySet. Return the total number of unlucky intervals that contain n. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | luckySet will contain between 2 and 50 elements, inclusive. | ||||||||||||
- | Each element of luckySet will be between 1 and 1000, inclusive. | ||||||||||||
- | Each element of luckySet will be distinct. | ||||||||||||
- | n will be between 1 and the largest element in luckySet, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|