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.
I still encounter this problem.
You are not correct. There is always only one number that is the first appearance
Excellent kata!
I have a small remark. The description is not precise.
It is not just a combination. It is the infinite sequence of digits defined as the concatenation of the sequence of strings representing the consecutive numbers from 1 to infinity.
In the description, the
reduce()
method is required to return a lambda object, but the tests expect a string instead.I'm also thinking about it (alpha-reduction). In general, the substitution operation requires that the variable "v" bound by an abstraction "lambda v.body" shouldn't be free in a term which is to replace some variable in the abstraction body
(one can say "v" should be "fresh" for the substitution term). Otherwise, an alpha-reduction should be done to avoid changes in semantics.
In some random tests such a situation may appear. In my solution https://www.codewars.com/kata/reviews/55f3256f0fd3072e02000115/groups/64f846e2717c5300019e476e, I throw an error then. Anyway, if I ignore it and "force" substitution with usual rules, all tests are passed.
You can use Axios to get the data. But anyway, this kata should have never been published. How on earth can a kata like this be maintained, it relies solely on the hopes the html structure of the web page does not change. Complete rubbish kata
I'm also unable to solve this kata in JS. Not sure it is still possible.
It's a version before refactoring. I wonder why it passed the tests.
This one is valid.
Mine does not use JSON.stringify(). I'm comparing arguments by strict equality.
This kata in JavaScript can't be done using Cheerio only. I've done it with Puppeteer but, unfortunately, I wasn't allowed to import Puppeteer here in order to submit my solution.
A useful fact:
It is sufficient to check if there exist a left neutral element "e" (ie. e * g == g for all g) and each element "g" has a left inverse (ie. there is "h" such that h * g == e).
Then, under associativity and using a few tricky comparisons, we can prove that any left inverse is also a right inverse, "e" is (two-sided) neutral element, from which the uniqeness of "e" and all inverses follows.
Oh, I've just seen that number_of_moves is not necessary. It suffices to return len(history) - 1.
Nice kata!