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.
Here's the test that I suggest to add (Haskell) which I believe is correct. My solution fails it but still passes current full test suite.
@Twilight_Sun, it is actually a valid puzzle:
There are 10 distinct letters: AEFHILORST, nine distinct leading letters: AFHILORST, and solution without leading zeroes does exist.
(It's easy to deduce here that E is 0 although no special-case for this deduction is needed to code it).
ha, have already read that book ;) It's really good and practical although I still have no clue how exactly lens types work together.
One last thing is to get paid for doing Haskell somehow
a bit verbose but efficient
O(N^2)
Sure. Both list spine and elements are lazily evaluated in Haskell. The list that times out is short in spine, but the last element takes forever to evaluate.
So in Haskell version you need to find the answer without ever touching the last element (!), which makes it very different and much harder than same kata in any other language
Not sure if that counts as spoiler but there's an article on fpcomplete.com about lenses that explains a lot and is very helpful for this kata (it is required to have idea about RankNTypes though)
after few failed attempts to submit an O(n) code (12 sec timeout) I gave up and unlocked solutions. Most of them are less efficient and none of few that looked interesting passed the tests, all failed with timeout
UPD: it did pass with a near miss time after repeatedly submitting the same code many times.
Tests don't verify cases when letters are reshuffled. E.g.
"word"
and"crow"
have only one replaced letter (d
vsc
) but other letters are reshuffled so answer should beFalse
. I wrote more blunt solution that doesn't check letter positions and it still passes.I'd allow one extra character for at least some variability in possible solutions, and they would still require firm grasp of the concept
man I need to learn lenses too
Haskell descriptions should be explicit that
import WordList
is required to bring wordsList into scope. This is the only thing that can explain such a low number of Haskell submissions (3 + one mine after I unlocked solutions only to find out how to bring wordList into scope)Wow that was much trickier than it looks :) Glad to discover that my ad hoc solution is relatively clear and readable, I expected to find out something much more simple and elegant upon submit
OK, thanks. Then probably tests in other one are weak because I passed it with solution which doesn't care about the order. Will post a counter-example there
Description mentions another kata and claims to be the same / more performant version of it. The other kata however has different rule: "subsequence need not be consecutive terms of the original sequence" whereas in this kata order matters.
For example solutions to this test example would be different:
lcs "nothardlythefinaltest" "zzzfinallyzzz"
this kata expects
"final"
, the other one would accept"afillny"
Loading more items...