• Custom User Avatar

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

  • Custom User Avatar

    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!

  • Custom User Avatar

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

  • Custom User Avatar

    Dude, cramping everything together on one line with single character names doesn't automatically make your code clever.

  • Custom User Avatar

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

  • Custom User Avatar

    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.