#1124

Longest Well-Performing Interval

expert · 1045 · lc medium +32 · verified · 37.1% accepted · 1,530 likes · top 15%

Description

You are given hours, a list of daily hours worked. A day is tiring if hours worked strictly exceeds 8. A well-performing interval has more tiring days than non-tiring days.

Return the length of the longest well-performing interval.

Example 1:

Input: hours = [9,9,6,0,6,6,9]
Output: 3
Explanation: The longest well-performing interval is [9,9,6].

Example 2:

Input: hours = [6,6,6]
Output: 0

Code

1
2
3