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 wonder what the time limit/estimate for a single 30x30 matrix in Python 3 is.
I used a single bytes sequence to store the matrix' bits (rows first), so I would only need to split it once to make a horizontal cut. For the vertical cuts I transposed the matrix first, so that would only need to be cut once.
I cached the already found Grundy numbers in a dict, so I wouldn't need to traverse them again.
So far, I got it down to a consistent 7.3 s on a random matrix on my machine, but that still fails tests 3 and 4. I ran out of ideas.
Should I be using a different data structure? I tried the same algorithm, but storing data as an integer, setting the individual bits, but that turned out to be way slower.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Digits Square Board
You are viewing a single comment's thread. Return to all comments →
I wonder what the time limit/estimate for a single 30x30 matrix in Python 3 is.
I used a single bytes sequence to store the matrix' bits (rows first), so I would only need to split it once to make a horizontal cut. For the vertical cuts I transposed the matrix first, so that would only need to be cut once.
I cached the already found Grundy numbers in a dict, so I wouldn't need to traverse them again.
So far, I got it down to a consistent 7.3 s on a random matrix on my machine, but that still fails tests 3 and 4. I ran out of ideas.
Should I be using a different data structure? I tried the same algorithm, but storing data as an integer, setting the individual bits, but that turned out to be way slower.