You are viewing a single comment's thread. Return to all comments →
There is no need to loop in the given range:
We can calculate with just the boundaries in O(1) as here:
floor(sqrt(b)) - ceil(sqrt(a)) + 1
Explained in https://www.hackerrank.com/challenges/sherlock-and-squares/forum/comments/859695
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 →
There is no need to loop in the given range:
We can calculate with just the boundaries in O(1) as here:
Explained in https://www.hackerrank.com/challenges/sherlock-and-squares/forum/comments/859695