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.
First of all: Thanks a lot. I'll try it again on my own before i look at your solution.
My question is: Is any loop "bad" for the performance? Or is there a difference between for example for and while in terms of performance?
Im just thinking about how to solve without iteration. Give me some time, i need to do this on paper first :D
Solutions based on hashing are restricted in some languages, they are not in some others, what should be fixed.
In general, a performant solution to this problem does not require hashing, it can be solved in O(n) time and O(1) space.
I am not exactly sure what your test with
nodes.Count < 1000
is trying to prove, but your code uses an inefficient approach which is expected to time out.Your solution being slow is not a kata issue.