Problems > K-th in the Times Table > Editorial

K-th in the Times Table — Solution & Editorial

Back to the Problem

Binary search the VALUE: for candidate v, the count of table entries ≤ v is ∑i min(N, v/i), computable in O(N). Find the smallest v with count ≥ K.

Complexity: O(N log(N²))