Ad
  • Default User Avatar

    There are so many solutions, it's mindblowing. I just had to delete my comment from before because only now i understand, what you did. I would love to hear your feedback to my task. I know now why Math.Abs didnt work. It was a stupid mistake i made.^^

  • 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

  • Default User Avatar

    Ok danke. Die Foreachschleife hätte mit dem Array auch funktioniert oder? Ja ich habs jetzt langsam raus, wann using und wann nicht. Da geht es lediglich darum, die Methoden und Klassen (etc.?), die verwendet werden, bereitzustellen und das findet man eh auf Microsoft learn. So wie ich das verstanden habe, ist das was nach using kommt ein Namespace.

  • Default User Avatar

    Performance is an important aspect in programming.

    A solution with a loop (while) causes the processor to iterate several times through the loop and every iteration takes time.

    If you find a solution without a loop you will have better performance.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    ich habe ein wenig gebraucht bis ich es richtig verstanden habe. Die Liste fängt mit "1" an oder? bei Arrays fängts ja bei "0" an. Da muss man immer ein wenig mitdenken welcher index was ist XD und das mit dem bFirst finde ich auch sehr interessant, weil es rückwärts zu wirken scheint XD. Echt cool. ich muss mir morgen nochmal die collections und generics zu gemüte führen. Vielen Dank für deine Mühe und schönen Abend noch

  • Custom User Avatar

    I didnt have a chance to run your code, but just reading it it seems to have insufficient time complexity and is most probably too slow.
    Expected approach is O(n) in time, and O(1) in space, while your solution seems to be O(n^2) in time and O(n) in space.

  • Custom User Avatar

    Can anyone explain the terms of the assignment? It is more or less clear what should be at the output and it is not at all clear what is at the input. It is impossible to understand.

  • Custom User Avatar

    I was wondering when a first solution abusing this fact will appear. now i know :)

  • Default User Avatar

    approved

  • 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.

  • Default User Avatar

    Citation: "Thanks to shadchnev, I broke all of the methods from the Hash class."
    That means the Hashtable and GetHashCode won't work or is slowed down, right?

  • 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.

  • Custom User Avatar

    Addressed with this fork, please verify.

  • Loading more items...