We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
you just have to think from machines perspective in these type of question if you will start iterATing through all no. it will sure consume a lot of machine time so think abt solution where you can skip some iteration like this guy... by the way ma python soln:
def squares(a, b):
sq=0
while(a<=b):
if str(math.sqrt(a))[-2:]==".0":
sq+=1
a=(a//math.sqrt(a)+1)**2
else:
a+=1
return sq
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Squares
You are viewing a single comment's thread. Return to all comments →
you just have to think from machines perspective in these type of question if you will start iterATing through all no. it will sure consume a lot of machine time so think abt solution where you can skip some iteration like this guy... by the way ma python soln:
def squares(a, b):