4 kyu
Combinations with identicals
Loading description...
Arrays
Permutations
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Initial solution setup incorrect -> nvm by design (other issue is solved)
Hard and challenging!
This comment has been hidden.
Well, for more fun, do it in a functional, pure oneliner, then mathematically prove it's correct.
:yum:
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 includestrue
,1
,"1"
, and another that includesfalse
,0
,and"0"
. If the array isn't already sorted a certain way prior to thefixUp
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.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 to1
) cannot be sorted the way I do it. I'll have to find some other way.Thanks for finding this!
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.
Just checked it out and it works fine now. Nicely done!
Wrong initial code syntax
That is by design, and not an issue.
Is there documentation anywhere I should have correct initial code syntax?
A better question: Is there even any documentation anywhere?
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.
But it doesn't say it has to compile, or be correct.
Sorry, but nearly the same code as before;-)... Have a nice day:-)!