Ad
  • Custom User Avatar

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

  • Custom User Avatar

    Nested loops are what cause the O(n^2) behavior!

    I suggest looking up "memoization" and seeing if that coding practice can help eliminate the need to do multiple passes over the list in question. :)

  • Custom User Avatar

    It's 2M if you are lucky.

  • Custom User Avatar

    For python it's ~1.5 mil, don't know about JS (probably similar)

  • Default User Avatar

    me too!

  • Default User Avatar

    These are the correct, complete memories from the Sample Tests (each length == 10):

    alice = ['plat', 'rend', 'bear', 'soar', 'mare', 'pare', 'flap', 'neat', 'clan', 'pore'];
    bob   = ['boar', 'clap', 'farm', 'lend', 'near', 'peat', 'pure', 'more', 'plan', 'soap'];
    

    Above you show arrays that have only 6 words each, but while they may share some words, they do not match the actual sample tests. So, if you are using those smaller (different) arrays in your own environment, you should not expect the same results as on codewars.

    When your code is run against the sample tests, it is clear that it fails two of the tests. Take another look at your code with those two tests in mind. You will have to match the tests on codewars to pass the kata.

    If you find any hard evidence of kata failure, feel free to re-raise as an issue if you can provide: the correct tests, the expected output, your output, and an explaination of why there is a problem. Thanks.