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.
It's just a basic math problem. GCD to get the side of the smaller sub-squares, get the area (power of 2), and divide the big area by the area of the squares.
return(l*b)/pow(std::gcd(l,b),2);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Restaurant
You are viewing a single comment's thread. Return to all comments →
It's just a basic math problem. GCD to get the side of the smaller sub-squares, get the area (power of 2), and divide the big area by the area of the squares.