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 think the comments was to discuss the actual kata and not made up requirements, but I'll offer my two cents.
I'm not sure if your underlying suggestion is to use JS Intl limited features to pluralize/translate the units, but internacionalization/localization is not trivial and the proper way to go is to use a library for it. Even for a simple kata like this we would need the following features:
So it's not like I would need to reimplement a one-line function if I wanted to localize to, let's say, Japanese. I would probably need to scrap that function altogether and use a completely different approach.
My take when approaching these katas is to use code that is readable and extensible. And stick to the most simple solution posible. A readable one-liner is not a bad take here IMO
Works as requested. But note that this would not work for languages other than english, because then it is not about adding a "s" to make the plural. So making it able to work with italin, spanish or other languages would make necessary to reimplement the formatUnit.
Thanks! Short? yes. Brilliant? ¯\_ (ツ) _/¯
I don't get something. Can somebody explain me why "if (maxWithDigits(i) === mx)"? By doing this you are searching for the max number, but actually what we want is to find the first number (minimum), higher than n, using the given digits.
Brilliant
One of the nicest solutions, IMHO
Very nice approach
This comment is hidden because it contains spoiler information about the solution