Given two integers, determine how many perfect cubes exist in the range between and including the two numbers
@ILM The instruction says “In the range” and “Including the two numbers”, i.e., 4 - 29, including 3 and 30 for countPerfectCubes(3, 30), so the number 2 is not in the range, nor the min or max.
That is why this test case countPerfectCubes(1, 30) passes and returns 3 perfect cubes cause we have 1, 2, and 3 in the range.
You seem confused on what a perfect cube is. When we say that 8 = 2*2*2, we say that 8 is a perfect cube because it is the result of a number multying itself in that way. 8 needs to be in the range to be counted, not 2.
Otherwise every number would need to be counted, any integer can create a perfect cube, 4*4*4 = 64, 5*5*5 = 125 and so on
the perfect cubes in the range 3-30 are 8 and 27
2 and 3 are not perfect cubes, there isn’t an integer n that gives those numbers when you calcualte n*n*n
no, that is 3 because you have 1, 8 and 27, which come from 1*1*1, 2*2*2 and 3*3*3
and when you go down to a range that starts at 0, the other perfect cube is 0 = 0*0*0
in the range -64, 64 there are 9 because -64 = -4*-4*-4, -27=-3*-3*-3, -8=-2*-2*-2, -1=-1*-1*-1, 0=0*0*0, 1=1*1*1, 8=2*2*2, 27=3*3*3, 64=4*4*4