Ad
  • Default User Avatar

    Yep, I know and already provided another solution.
    The thing is that there is no check for odd number of the same letter in this Kata.
    That's why I proposed to add 'aaa' test case.

  • Custom User Avatar

    So your code fails when there is an odd number of the same letter.

  • Default User Avatar

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

  • Custom User Avatar

    There are already tests with "a" and "aa" as input (at least in Python and Javascript). Which language are you talking about?

  • Default User Avatar

    Hi!
    It would be great to add test cases like 'aaa', 'aa' and 'a'.
    I found a solution which could pass all tests, but can't handle 'aaa', 'aa' and 'a'.

  • Default User Avatar

    Seems that test cases were chaged after this solution.
    'http://google.co.jp' returns 'co' instead of 'google'

  • Custom User Avatar

    Thenks for finding an edge case Mincer!

    Sadly, at this point such a change might invalidate a good number of solutions, and I'm not familiar with the process involved there for CodeWars.

    The tests also do not have random list tests, and do not protect from user manipulation of the data sets.

    As this problem is now a little over 6 years-old, I'm inclined to leave it as-is. Particularly, due to the fact that as a method to teach people about the power of limiting array traversals and the usefulness of hashmaps, it still fulfills that need.

  • Default User Avatar

    That's why I ask to add such test case to avoid accepting non universal solutions.

  • Default User Avatar

    Hm, re-check your solution again. Universal solution can handle datasets like this....

  • Default User Avatar

    What do you think about adding sum_pairs([12, 4, 5, 3, 8, 7, 5, -2], 10) in test cases?
    In such dataset you can find 3 nested pairs: [12,-2], [5, 5], [3, 7] where [3, 7] is the right pair.

    The thing is, that I wrote solution, which passes all tests and successful at attempt, but can't handle provided dataset because it has 3 nested pairs.
    Including sum_pairs([12, 4, 5, 3, 8, 7, 5, -2], 10) will help avoid wrong solutions.

  • Default User Avatar

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

  • Custom User Avatar

    Great tip -- really pushed me over the edge. Math the solution not code.

  • Custom User Avatar

    I had solved the test with loops but timed out. Saw your tip and A HA! I solved the tests with a totally new approach (no loops) but it still times out. Grrr EDIT: Another commenter here mentioned sorting the arrays itself will cause a timeout. Although I did remove the for loops I had left the code to sort the array even though it wasn't necessary anymore. Problem solved.

  • Custom User Avatar

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

  • Custom User Avatar

    Three different ways with less than 1s for tests and still timing out

  • Loading more items...