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 think I have a Java implementation of an algorithm, but it's getting hammered in matrix multiplies where the elements are "BigMod" objects representing integers modulo 998244353, with addition, multiplication, inverse,... I'm wondering if the problem is brain leakage -- I know my algorithm is O(nNodes ** 3), maybe there's a better algorithm. On the other hand, if this really is the bound, is it worthwhile to rewrite in C/C++ or Python? Another angle would be to use a proper matrix package and converting operation results by % 998244353. Is there some way to import external (git-accessible) libraries into a Hackerrank workspace?

## Definite Random Walks

You are viewing a single comment's thread. Return to all comments →

I think I have a Java implementation of an algorithm, but it's getting hammered in matrix multiplies where the elements are "BigMod" objects representing integers modulo 998244353, with addition, multiplication, inverse,... I'm wondering if the problem is brain leakage -- I know my algorithm is O(nNodes ** 3), maybe there's a better algorithm. On the other hand, if this really is the bound, is it worthwhile to rewrite in C/C++ or Python? Another angle would be to use a proper matrix package and converting operation results by % 998244353. Is there some way to import external (git-accessible) libraries into a Hackerrank workspace?