Tap here to switch tabs
Problem
Submissions

Problem: Count K-th Roots in a Range

Count K-th Roots in a Range asks you to count integers in an inclusive range that equal a nonnegative integer raised to the given positive power, including zero.

Statement

Given three integers l, r, and k, return the number of integers in the inclusive range [[l, r]] that can be represented as nkn^k for some integer n≥0n \geq 0.

Constraints:

  • 0≤0 \leq l ≤\leq r ≤109\leq 10^9

  • 1≤1 \leq k ≤30\leq 30

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count K-th Roots in a Range

Count K-th Roots in a Range asks you to count integers in an inclusive range that equal a nonnegative integer raised to the given positive power, including zero.

Statement

Given three integers l, r, and k, return the number of integers in the inclusive range [[l, r]] that can be represented as nkn^k for some integer n≥0n \geq 0.

Constraints:

  • 0≤0 \leq l ≤\leq r ≤109\leq 10^9

  • 1≤1 \leq k ≤30\leq 30