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.
Amazing kata, realized immediately that it is a generalization of a famous "high school pyramid" :P
getting it right took some time though
This comment is hidden because it contains spoiler information about the solution
first solution O(N^4), TLE;
second solution O(N^2), TLE;
third solution O(N), pass!
amazing kata!
it passes the test without caching or precalculating
This comment is hidden because it contains spoiler information about the solution
the solution I provided is overkill for this problem, it finds all connected components in
O(rows*cols*α(rows*cols))
time (t.l.d.r.: proportional to the matrix size, which is optimal).runs in linear time.
Thanks for checking the issue, wish you a happy 2024!
In golang there are some issues with the testing framework,
at some point during the random tests it outputs:
I checked using printfs that my code outputs the correct result, I.E.:
moreover the testing code sometimes fails to find all solutions...