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
There is no point or advantage it is just because.
I did solve this kata quite a long time ago so I can't exactly tell you why I did for this one but there are probably others too.
And what was the point of putting all the logic in the constructor? I don't see an advantage. Just because? I mean you could do that with just about any function. Why this one?
The problem is described as taking an array, but in Java it actually takes a List/ArrayList. Can you change the problem or the description so its consistent?
Thanks!
it's not designed as readable code.
I use something faster than O(N^2) but it does not pass. How much time does your solution take to complete?
This comment is hidden because it contains spoiler information about the solution
the idea wasn't to make my code clever the goal was to place all the logic within the constructor of the function.
Dude, cramping everything together on one line with single character names doesn't automatically make your code clever.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Nowhere does it say that you may not modify the input, e.g. adding properties. Also, the error messages you get give you no hint whatsoever that you are not allowed to modify the input.
That said, I solved it by adding a flag prop to the nodes, ad then doing a second sweep to remove the flags. So there's also nothing that keeps you from modifying it, as long as you put it back.
Not a bad problem, but it's way too easy for 3kyu. The only difficult thing about it is figuring out that you have to leave the input as it was.