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.
The purpose of big numbers is to eliminate naive solutions. Standard js numbers are big enough for that. No need to make people think about specifics of data types in different languages.
If ones solution doesn't handle such cases naturally than this rule will only make them add checks, not rethink the solution. People usually don't expect validation in algorithmic kata.
Fixed and specified. Thanks for feedback!
All anagrams are unique, that's where the difficulty comes from. If you allow duplicates or have each letter only ones in a word then it's just like counting in base number_of_letters.
This will significantly increase the number of function calls since in this part -
cc(amount - coins[coin], coin)
its more profitable to reduce the 'amount' quicker. Without sorting:
countChange(300, [5,10,20,50,100,200,500]) - 30577 calls
countChange2(300, [5,10,20,50,100,200,500].reverse()) - 119305 calls
I don't pass 3 args to gcd, it's an initial value in reduce function. There is a formula that relates an lcm through the gcd, so you don't need to use factorisation. But using reduce for making a string from an array was a bad decision - to many string concatenations. Map and join are much more efficient, especially with template strings.
"The single responsibility principle states that every module or class should have responsibility over a single part of the functionality provided by the software". But not the functionality of a single operator! Why did't you write something like this?
So there are some more overrated kata:
And many other kata with too big ranks.
Полная херня.
Very bad code.
And what if some kata are highly overrated? For example this one - check if two values are in specific range. Or this - can be solved in one line with a simple regex. They are both 4 kyu when should be not more than 6.
This function returns another function just becaгse you thought that your solution isn't enough "functional"? Why not using a simple function with two parameters?
All array methods will work with 'arguments' as well. There is no need to transform 'arguments' before using reduce.
You should definitely write some even more tricky random cases for js. I have passed all tests with this code.
Loading more items...