• + 0 comments
    def squares(a, b):
        
        # Find the smallest integer whose square is >= a
        start = math.ceil(math.sqrt(a))
        # Find the largest integer whose square is <= b
        end = math.floor(math.sqrt(b))
        # The count of perfect squares is the difference + 1
        return max(0, end - start + 1)