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.
The test data for this problem is very strong. Even my O(nmmin(n, m)) failed some tests. In the end I profiled my code and found the bottleneck is log2() in my Sparse table lookup. The value of log2(x) could be precalculated, or implemented with a tricky one(https://stackoverflow.com/a/11398748/4140668).
Vote for Difficulty:Hard due to its test data
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Largest Pyramid
You are viewing a single comment's thread. Return to all comments →
The test data for this problem is very strong. Even my O(nmmin(n, m)) failed some tests. In the end I profiled my code and found the bottleneck is log2() in my Sparse table lookup. The value of log2(x) could be precalculated, or implemented with a tricky one(https://stackoverflow.com/a/11398748/4140668).
Vote for Difficulty:Hard due to its test data