Practice Maximum Consecutive Floors Without Special Floors
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
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.
Source: Maximum Consecutive Floors Without Special Floors on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
bottom = 2, top = 9, special = [4,6]
3
# Example 2
bottom = 6, top = 8, special = [7,6,8]
0
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Consecutive Floors Without Special Floors.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.