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 need to find the number of integers whose squares lie in the given boundary values. Hence, it is the same as finding the number of integers between the square roots of the given boundary values. Since the values are inclusive, floor of the square root of upper boundary is subtracted to the ceil of the square root of lower boundary which gives number of integers between them. 1 is added to include the first one also
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 need to find the number of integers whose squares lie in the given boundary values. Hence, it is the same as finding the number of integers between the square roots of the given boundary values. Since the values are inclusive, floor of the square root of upper boundary is subtracted to the ceil of the square root of lower boundary which gives number of integers between them. 1 is added to include the first one also