Premium problem152. Longest Streak of Consecutive Active Days

Hard Locked

Given a 1-D array of daily activity flags (1 = active, 0 = not), return the length of the longest streak:

  • count the longest run of consecutive 1s
  • return 0 if there are none

Input

[1 1 0 1 1 1 0 1]

Output

3

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)