Problems > Zero Then One > Editorial

Zero Then One — Solution & Editorial

Back to the Problem

Sweep once: every 1 pairs with all zeros seen so far.

Complexity: O(|S|)

Watch out: Up to ~2.5×109 pairs — 64-bit.