P16128 [GeeksforGeeks] Perfect cubes in a range3933
普及-
题目描述

Given two given numbers a and b where 1<= a <= b, find the perfect cubes between a and b (a and b inclusive).
Example 1:
Input: a = 1, b = 100
Output: 1 8 27 64
Explaination: These are the proper cubes between
1 and 100.
Example 2:
Input: a = 24, b = 576
Output: 27 64 125 216 343 512
Explaination: These are the proper cubes between
24 and 576.
Your Task:
You do not need to read input or print anything. Your task is to complete the function properCubes() which takes a and b as input parameters and returns the proper cubes between a and b. The function returns -1 if there is no proper cube between the given values.
Expected Time Complexity: O(cuberoot(b))
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ a ≤ b ≤ 10^{4}

输入格式

见题面

输出格式

见题面

样例输入
a = 1, b = 100
样例输出
1 8 27 64