• + 0 comments

    python solution with O(1).

    import math
    def squares(a, b):
        #pow(a, 0.5) ~ pow(b, 0.5)
        start = math.ceil(pow(a, 0.5))
        end = math.floor(pow(b, 0.5))
        return end-start+1