Alice has leased every floor from bottom to top, including both. Among these floors, some are marked as special floors—these cannot be used as regular office areas.
You are given an array special, where each value represents a floor that has been marked as special.
Your task is to determine the longest continuous stretch of floors that does not contain any special floor at all.
Return the length of this longest uninterrupted block of normal (non-special) floors.
Input: bottom = 1, top = 10, special = [2, 5, 9]
Output: 3
Explanation:
Non-special ranges are: (3, 4) → length 2 (6, 8) → length 3 (10, 10) → length 1 The longest continuous segment is from 6 to 8, but including floor 10 individually also gives 1. Thus, the maximum non-special floors = 3.
Input: bottom = 15, top = 20, special = [15, 17, 20]
Output: 2
Explanation:
Non-special ranges: (16, 16) → 1 (18, 19) → 2 Maximum length = 2.
Accepted:
Submission: