Loading [MathJax]/jax/output/CommonHTML/jax.js
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 ak>0 for each index i≤k≤j. ### Input - The first line contains an integers n. - The second line contains n integers Ai. ### Output - Print the length of longest possible subarray. ### Constraints - 1≤n≤1000. - |Ai|≤1000. ### Example Input: 6-1-2342-2 Output: 3