4 kyu

Combinations with identicals

Description
Loading description...
Arrays
Permutations
Algorithms
  • Please sign in or sign up to leave a comment.
  • dfhwze Avatar

    Initial solution setup incorrect -> nvm by design (other issue is solved)

  • RealKenshiro Avatar

    Hard and challenging!

  • dayfine Avatar

    This comment has been hidden.

  • docgunthrop Avatar

    Nice enjoyable kata 👍.

    One issue I'm seeing is with the Array.prototype.fixUp pre-loaded method. It appears to get mixed up when sorting similar truthy values and similar falsey values. There are two test cases where this issue arises: one test case that includes true,1,"1", and another that includes false,0,and "0". If the array isn't already sorted a certain way prior to the fixUp method's sorting, the test result will fail.

    To see this in action, you can run my submitted solution with the sort removed from the return value.

    • JohanWiltink Avatar

      Possibly this occurs because JS coerces types when comparing with >, >=, < and <= (and ==). Unfortunately, there are no non-coercing variants of that. Another problem might be .sort() is not guaranteed to be stable. In effect, true, 1 and "1" (which all coerce to 1) cannot be sorted the way I do it. I'll have to find some other way.

      Thanks for finding this!

    • JohanWiltink Avatar

      I am now first sorting on types, then on values. This should work. I've done some testing and it does seem to work.

      Could you also try and let me know if you still find any problems? Mind that when forking a solution, you seem to get the old Tests and Preloaded, you have to make sure you're working in an uncached, updated version of the kata.

    • docgunthrop Avatar

      Just checked it out and it works fine now. Nicely done!

      Issue marked resolved by docgunthrop 8 years ago
  • Voile Avatar

    Wrong initial code syntax

    • JohanWiltink Avatar

      That is by design, and not an issue.

      Is there documentation anywhere I should have correct initial code syntax?

      Issue marked resolved by JohanWiltink 8 years ago
    • Voile Avatar

      A better question: Is there even any documentation anywhere?

    • JohanWiltink Avatar

      There is some, of course. There is the Test Framework and Creator Documentation from the left side menu, and there are the Help texts in the various Editors.

      The initial solution block is required so you will have to include something (at the very least some comments) in order for the kata to be able to be published.

      But it doesn't say it has to compile, or be correct.

  • smile67 Avatar

    Sorry, but nearly the same code as before;-)... Have a nice day:-)!