shifts is an employee's work log: shifts[i] is how many hours they worked on day i. A day is hard if they worked strictly more than 8 hours; otherwise it is light.
Find the longest run of consecutive days in which hard days strictly outnumber light ones.
Return the length of that run, or 0 if no such run exists.shifts=[10, 4, 12, 11, 3, 2, 7] → 5
The first five days [10, 4, 12, 11, 3] hold three hard days and two light ones. No longer stretch has more hard days than light ones.
shifts=[8, 5, 8] → 0
Exactly 8 hours is not yet a hard day, so there are no hard days at all and the answer is 0.
shifts=[9, 0, 9, 0, 9] → 5
The whole period works: three hard days against two light ones.
len(shifts) ≤ 10⁴shifts[i] ≤ 16shifts=[10, 4, 12, 11, 3, 2, 7]
5
Run checks the first 3 tests in your browser. Submit checks all 102 tests on the server, hidden ones included.