#K58337. Longest Like Streak

    ID: 30620 Type: Default 1000ms 256MiB

Longest Like Streak

Longest Like Streak

Given a sequence of user actions represented by either 1 (like) or -1 (unlike), determine the longest consecutive streak of likes (1s) for each test case.

For each test case, you are given an integer (N) denoting the number of actions, followed by (N) integers representing the user actions. Your task is to compute the maximum number of consecutive 1s in the sequence.

inputFormat

The input is given via standard input (stdin). The first line contains an integer (T), the number of test cases.

Each test case consists of two lines:
- The first line contains a single integer (N), the number of actions.
- The second line contains (N) space-separated integers, each being either 1 or -1.

outputFormat

For each test case, output a single line (via standard output, stdout) containing the maximum number of consecutive likes (1s) in the given sequence.## sample

1
8
1 1 -1 1 1 1 -1 1
3

</p>