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

    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.