Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
You are simulating pattern matching. Read the #Performance note.
Every operation can be a right fold ( one fold per input list, interwoven if more than one ).
Don't look at the type error - it's not helping in this case. You are misapplying types somewhere. Have a good look at what is a list and what is an element. ( It helps me to name lists
xs
instead ofl
. )(cons (head x) ...
x is not a listRandom tests are incorrect in Haskell, there are already issues raised about that. I assume after seeing your profile that this is the language you are using. Please say it next time.
ive looked at the Python and JS tests and they never generate duplicate elements. it would require a redefinition of the problem anyway, since
[4, 5, 5]
can be seen as bothA
orRD
. i've added this to the description[7, 7, 1, 2, 3, 4, 5]
is not RA becase7 < 7
is false; and there's always an answer by definition.This comment is hidden because it contains spoiler information about the solution