Count the Hidden Sequences LeetCode solution in Python

1
class Solution:
2
def numberOfArrays(self, differences: List[int], lower: int, upper: int) -> int:
3
l = [0]
4
for i in differences:
5
l.append(l[-1] + i)
6
return max(0, (upper - lower + 1) - (max(l) - min(l)))

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0