Ad
  • Default User Avatar

    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

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.