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.
why not using lambda and join atp? (i don't know if it's actually possible, but i think it should be just by looking at how you used the return)
Not a good practice to use exceptions for implementing normal program flow.
Exactly how I did it :)
you best
Did this lmao
I knew it!
You are correct. =) But I solve katas for fun, and sometimes that goes against best practises.
Putting the whole function in one line may be clever, but it's not best practices.
Yep, this is O(n²) for the reason you explained.
And I disagree with RazNaot, just because you can solve a problem inefficiently doesn't mean you should. The goal of this website is to improve at programming.
Oh, I see. Thank you.
The custom in this site for the easier katas, is not to be restricted by performance and memory constraints. At most katas leveled kyu 8 to kyu 6, almost all algorithms will work. They are meant to be easy training, with fewer and smaller test cases - so just do something that works and you'll pass. The harder katas - around kyu 5,4 and up may require "performance" - i.e. slower algos may fail etc. Browse "Kata" on the top left menu to get to harder questions...
Did anyone check the complexity of this solution?
It's very short and nice, but is it optimal in terms of CPU/RAM usage?
As I can see we will get one list traversal for getting a set. Then we will get a traversal per each element in the set. Which i think is suboptimal.
Thoughts?
This comment is hidden because it contains spoiler information about the solution