Problems > Count Sign Changes > Editorial

Count Sign Changes — Solution & Editorial

Back to the Problem

Filter out zeros first, then compare the sign of each survivor with the previous one.

Complexity: O(N)