3932. Count K-th Roots in a Range
You are given three integers l, r, and k. An integer y is said to be a perfect kth power if there exists an integer x such that y = xk. Return the number of integers y in the range [l, r] (inclusive) that are perfect kth powers. Example 1: Input: l = 1, r = 9, k = 3 Output: 2 Explanation: The perfect cubes in the range [1, 9] are: - 1 = 13 - 8 = 23 Hence, the answer is 2. Example 2:
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start