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.
This comment is hidden because it contains spoiler information about the solution
It's mine.
Not an issue. Tags are often set automatically and cannot be changed.
This comment is hidden because it contains spoiler information about the solution
Very easy coding (about 8kyu). But requires a lot of thought
just started today. may take a few days from the looks of it
You're mutating the original list.
That is because "Test" just runs sample tests, which are the demonstrative tests you see in the sample tests editor. The "real" test suite is run when you hit "Attempt", and it features many more tests, some of which can have extremely large inputs that require an efficient algorithm to solve. Your current solution loops over every item, and for each item, loops over all other items. That is what makes it O(n²), meaning the computation time grows quadratically with input size. You need to find a different approach that avoids nested loops.
This isn't issue (as this refers to issue with kata), but question (and there's tag for that) and to answer it, by reducing time complexity of your code which currently is
O(n^2)
, by using external data structure which can make itO(n*logn)
.not an issue
6 seems fair to me. There are definitely misranked katas though, so the description itself is always the better indication of difficulty. The rank is just the bounty!
Different ways of representing the problem leads to different ways of having to manipulate that representation.
This problem is representable with pen and paper, so that is a great place to start.
edit: Admittedly my approach to this problem looks nothing like other 6kyu kata.
In your profile there is the 'Solutions' tab.