Ad
  • Custom User Avatar

    The "issue" tag is for problems with the kata, not problems you're having solving the kata. Please use the "question" tag if you want help with your code.

    A couple of hints for solving this kata:

    1. NSCountedSet is much slower than just counting the elements manually. You can solve this by writing your own counting logic rather than relying on the library implementation. Or, better yet...
    2. If I gave you the set [8, 2, 8, 8, 8, 8, ..., 8] how many elements would you need to see before returning the answer? There are ways to solve this without counting anything at all, and (usually) without iterating the whole array.

    When I implement a counting solution (not using NSCountedSet) it succeeds in about 5000ms, but if I consider the second hint my solution instead takes 600ms. Think about it.