Maximum Consecutive Floors Without Special Floors LeetCode solution in Python

1
class Solution:
2
def maxConsecutive(self, bottom: int, top: int, special: List[int]) -> int:
3
special.sort()
4
special.insert(0, bottom - 1)
5
special.append(top + 1)
6

7
ans = 0
8
for i in range(len(special) - 1):
9
ans = max(ans, special[i + 1] - special[i] - 1)
10
return ans

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0