Ad
  • Custom User Avatar

    I disagree about marking the comment as spoiler, but not going to change your update. The best approach would be for the author to update the test cases first. After that, unmarking the spoiler would give beginners something to think about. :)

  • Custom User Avatar

    Marked as spoiler (raised an issue above so it calls author's attention and if he doesn't fix it, in a week any power-user can do it), because the hack solution explanation isn't needed. Using pop for this is a little weird, but, it's true that if no warning about input mutation on a beginner kata is mentioned it could seem weird to them.

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    This (Ching Ching's) comment helped me to figure things out. Correct me if I'm wrong, but from a language perspective within the front_back_split() function, if you write something like front = Node(3), it does NOT propogae outside the front_back_split() function. However, the front object that's passed in is mutable. Which means if you do something like front.data = 3, it will be seen by the calling code.

    So, at the end of the day, I think the instructions are perfectly fine. Might help to remind Python programmers that what we need to do here is modify the passed in value and not blindly reassign. (to repeat the example, writing front = source within the function has no effect outside the function).

  • Custom User Avatar

    From a readability perspective, I like this solution. It maps to the question very well.

    Yes - it's not very optimal, but I'd rather pick maintanable code over anything else.