Ad
  • Default User Avatar

    There's no mutation involved; the first list remains the same. Just populate the other two provided lists from the items of the first list as described. And since this task is specifically to populate these already provided list objects, the kata explicitly does not want you to create and return two new objects.

  • Custom User Avatar

    Isn't mutation an antipattern? Why would we not take a single input and return two new lists?

  • Custom User Avatar

    Three lists are passed to your function, the source and the other two you have to populate.

  • Default User Avatar

    I don't understand this Kata for Python 3.6.

    So I'm supposed to take a single list and split it into two, right?

    So why are there three inputs: source, front, back?

    I thought the first thing I'd do is print all three inputs to try and figure this out, or at least just understand what form this list is arriving... but all I get back is a reference to the Node object which I don't feel has been properly explained.

    Anyone able to clear up what these instructions want me to do for a Python 3.6 implementation?

  • Default User Avatar

    This was the issue.

    I was dropping values from the list if they didn't have a pair and mutating the original list. Quite difficult to debug!

    Copying the list solved this issue. I can see the argument for not passing a copy, equally, I wasn't aware the same list was going to be reused in mutliple tests. Maybe some test to check the list hasn't been mutated?

  • Custom User Avatar

    @oliver.farren: You're doing something wrong, the ints list should have 10 million elements. Make sure you're not mutating the list because it's used in more than one test.

    @AlejandorLazaro: pass a copy of the list to the user instead.

  • Default User Avatar

    Ah, I was reading the wrong log.

    Still have the same issue...

    num ints:9999998, s:16
    Counter({1: 9999994, 6: 1, 7: 1, 8: 1, -3: 1})

    I still don't see a valid pair there that sums to 16.

    I'm using Python 3.6.

  • Default User Avatar

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

  • Custom User Avatar

    What language are you using? The test case you point out should have a sum value of 16, not 31.

  • Default User Avatar

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