• + 1 comment

    Nice. This line looks a little weird to me:

    Math.sqrt(n) % 1 == 0
    

    Any integer % 1 is always 0. So it seems that line is just checking if the square root of n is an integer or not.

    HackerRank solutions.