Problems > Position of the K-th One > Editorial

Position of the K-th One — Solution & Editorial

Back to the Problem

Precompute the positions of all ones in order; each query indexes that list.

Complexity: O(length + Q)