title: Interview: Find the whole cubes between range of two Integers
body: <p>I just gave a coding interview on codility</p>
  
  <p>I was asked the to implement the following, but i was not able to finish it in 20 minutes, now I am here to get ideas form this community</p>
  
  <p>Write a function <code>public int whole_cubes_count ( int A,int B )</code> where it should return whole cubes within the range</p>
  
  <p>For example if A=8 and B=65, all the possible cubes in the range are 2^3 =8 , 3^3 =27 and 4^3=64, so the function should return  count 3</p>
  
  <p>I was not able to figure out how to identify a number as whole cube.  How do I solve this problem?</p>
  
  <p>A and B can have range from [-20000 to 20000]</p>
  
  <p>This is what I tried</p>
  
  <pre><code>import java.util.Scanner;
  class Solution1 {
    public int whole_cubes_count ( int A,int B ) {
        int count =0;
  
      while(A&lt;=B)
      {
          double v = Math.pow(A, 1 / 3); // &lt;&lt; What goes here?
          System.out.println(v);
          if (v&lt;=B)
              {
              count=count+1;
              }
          A =A +1;
      }
      return count ;
    }
  
    public static void main(String[] args) 
    {
      System.out.println("Enter 1st Number");
      Scanner scan = new Scanner(System.in);
      int s1 = scan.nextInt();
      System.out.println("Enter 2nd Number");
      //Scanner scan = new Scanner(System.in);
      int s2 = scan.nextInt();
      Solution1 n = new Solution1();
       System.out.println(n.whole_cubes_count (s1,s2));
    }
  }
  </code></pre>