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.
I was able to make it working using the below algorithm.
private static long findNums(long totalTiles){
int maxLvel = (int)Math.sqrt(totalTiles-1)/2;
long count = 0;
for(int i = 1;i<=maxLvel;i++){
//Finds number of laminates of the same level. For a a given hole size h and a level l (2*(l+h/2))^2 <= tiles + h^2
count += (long) ((totalTiles/(4*i))-i);
}
return count;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #173: Using up to one million tiles how many different "hollow" square laminae can be formed?
You are viewing a single comment's thread. Return to all comments →