Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
The random tests in Python have several issues:
2
instead of10
per the description.$[a,b]$
, which is not a guaranteed property of the generated matrices.Following that rule, all remaining moves would be skipped if the player's row was empty, because there are no valid moves.
The reference solution in Python does not follow this rule, which can lead to unexpected failures in the random tests for solutions that do follow the rule.
Here's one such input:
It seems that the performance version has looser performance requirements than I expected, because my refsol only performs a single optimization to trim the search space for common subsequences instead of the full DP implementation.
I've forked my fork, reverting the reference solution.
I've made a fork that addresses all of these along with updating the reference solution to be much more efficient.
Random tests in Haskell could use some work:
Char
, leading to pairs of strings like"G8\1100651\95058\SUB\\A\b"
and"\n\n"
expected: 0 but got: 3
, with no indication of what the numbers indicate.expected: True but got: False
, which again does not tell the solver what the actual problem is.Not a bad idea! Forked with the suggested description changes.
Haskell fork
Haskell translation
I'm 100% in agreement with your logic, and the description should definitely be updated with some clarification. Here's how I would describe the circuit.
Naive solution.
Let
$m$
be the number of distinct elements of$a$
and$n$
be the length of$a$
.Time complexity:
$\mathcal{O}(m \cdot n)$
Space complexity:
$\mathcal{O}(m)$
Fork that updates the random tests.
No problem. I've forked my translation here incorporating the changes.
There wasn't too much of a performance hit with the previous constraints, but it is definitely more common to work with 64 bit signed integers (
Int
) vs. unbounded integers (Integer
).Haskell translation
Haskell translation
Loading more items...