Positive subarray - MarisaOJ: Marisa Online Judge

Positive subarray

Time limit: 1000 ms
Memory limit: 256 MB
You are given an integer array $A$ of length $n$. Find the length of the longest subarray that contains only positive values. In other words, find the maximum value $j - i + 1$ such that $a_k > 0$ for each index $i \le k \le j$. ### Input - The first line contains an integers $n$. - The second line contains $n$ integers $A_i$. ### Output - Print the length of longest possible subarray. ### Constraints - $1 \le n \le 1000$. - $|A_i| \le 1000$. ### Example Input: ``` 6 -1 -2 3 4 2 -2 ``` Output: ``` 3 ```