Alice manages a company and has rented some floors of a building as office space. Alice has decided some of these floors should be special floors, used for relaxation only.

You are given two integers bottom and top, which denote that Alice has rented all the floors from bottom to top (inclusive). You are also given the integer array special, where special[i] denotes a special floor that Alice has designated for relaxation.

Return the maximum number of consecutive floors without a special floor.

&nbsp;
Example 1:

Input: bottom = 2, top = 9, special = [4,6]
Output: 3
Explanation: The following are the ranges (inclusive) of consecutive floors without a special floor:
- (2, 3) with a total amount of 2 floors.
- (5, 5) with a total amount of 1 floor.
- (7, 9) with a total amount of 3 floors.
Therefore, we return the maximum number which is 3 floors.


Example 2:

Input: bottom = 6, top = 8, special = [7,6,8]
Output: 0
Explanation: Every floor rented is a special floor, so we return 0.


&nbsp;
Constraints:


	1 &lt;= special.length &lt;= 105
	1 &lt;= bottom &lt;= special[i] &lt;= top &lt;= 109
	All the values of special are unique.


class Solution:
    def maxConsecutive(self, bottom: int, top: int, special: List[int]) -> int:
        special.sort()
        special.insert(0, bottom - 1)
        special.append(top + 1)
        
        ans = 0
        for i in range(len(special)-1):
            ans = max(ans, special[i+1] - special[i] - 1)
        return ans
class Solution {
    public int maxConsecutive(int bottom, int top, int[] special) {
        int max = Integer.MIN_VALUE;

        Arrays.sort(special);

        // from bottom to the first special floor
        max = Math.max(max, special[0] - bottom);

        // middle floors
        for(int i = 1; i < special.length; i++) {
            max = Math.max(max, special[i] - special[i - 1] - 1);
        }

        // from last special floor to the top
        max = Math.max(max, top - special[special.length - 1]);

        return max;
    }
}
class Solution {
public:
    int maxConsecutive(int bottom, int top, vector<int>& special) {

        int res(0), n(size(special));
        sort(begin(special), end(special));

        for (int i=1; i<n; i++) {
            res = max(res, special[i]-special[i-1]-1);
        }

        return max({res, special[0]-bottom, top-special[n-1]});
    }
};
/**
 * @param {number} bottom
 * @param {number} top
 * @param {number[]} special
 * @return {number}
 */
var maxConsecutive = function(bottom, top, special) {
    special.push(top+1);
    special.push(bottom-1);
    special.sort((a, b) => a - b);
    let specialMax = 0;
    for (let i = 1; i < special.length; i++){
        specialMax = Math.max(specialMax, special[i] - special[i-1] - 1)
    }
    return specialMax;
};
Maximum Consecutive Floors Without Special Floors