@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
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 vs c) but other letters are reshuffled so answer should be False. 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"
First I was going to suggest that it needs an OPTIMIZATOIN tag, but actually no, it doesn't ;)