Problem Statement | |||||||||||||
An array of ints is said to be a straight if it contains five elements that are five consecutive numbers. For example, the array { 6, 1, 9, 5, 7, 15, 8 } is a straight because it contains 5, 6, 7, 8, and 9. Given an array of ints, nums, return the minimum number of ints that must be added to that array, so that the augmented array is a straight. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | nums contains between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element in nums is between 0 and 1,000,000,000, inclusive. | ||||||||||||
- | All elements in nums are distinct. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|