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.
That is still not very good - You should only go to sqrt(n) + 1. It really makes the difference - try running it for some little bigger number like 1 billion or more - it is more than 10000 times slower then it could be for 1 billion for example :)
Of course when going only to sqrt(n) + 1, You need to do an extra step, but You will come up with it
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 19: Interfaces
You are viewing a single comment's thread. Return to all comments →
That is still not very good - You should only go to sqrt(n) + 1. It really makes the difference - try running it for some little bigger number like 1 billion or more - it is more than 10000 times slower then it could be for 1 billion for example :) Of course when going only to sqrt(n) + 1, You need to do an extra step, but You will come up with it