How do I find a maximum number of consecutive non-zero values in the array?

Ah my bad you are right! :grinning:

I made the opposite, the maximum number of zero values in an array!!

And your code is actually more compact because you update the maximum each time instead of updating at the end of a non-zero sequence of numbers :yum:

1 Like