Longest streak with stock on the shelf
A pharmacy chain in Nairobi records the closing stock of a vital medicine every day. A day with stock 0 is a stockout. The regional manager wants the longest run of consecutive days in which the medicine was never out of stock, as a proof of good supply planning.
Task: the first line holds n (1 to 300). The second line holds n non-negative integers, the closing stock of each day. Print two integers separated by a space: the length of the longest run of days with stock greater than 0, and the 1-based day on which that run starts (choose the earliest run if there is a tie). If every day is a stockout, print 0 0.
Sample test
Input
10 5 3 0 4 4 4 0 2 2 0
Expected output
3 4
Your answer is also checked against 5 hidden tests.
Log in or create a free account to run your code, submit and earn points.
Run your code to see the output here. Ctrl + Enter also runs it.
