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.
Without having seen your code, I came up with pretty much exactly the same solution.
It took me 10 minutes to do as a few month ago, I had a simular but more complicated problem with cubes and negative numbers in range allowed.
Performance wise, it is probably amongst best solution possible, as not worrying about sqrt and intermediate values that are not squares.
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 →
Without having seen your code, I came up with pretty much exactly the same solution. It took me 10 minutes to do as a few month ago, I had a simular but more complicated problem with cubes and negative numbers in range allowed. Performance wise, it is probably amongst best solution possible, as not worrying about sqrt and intermediate values that are not squares.