• Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Fixed and specified. Thanks for feedback!

  • Custom User Avatar

    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.

  • Custom User Avatar

    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

  • Custom User Avatar

    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.

  • Custom User Avatar

    "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?

    function isEqual(left, right) {
      return left === right;
    }
    function isUndefined(value) {
      return isEqual(value, undefined)
    }
    function isDefined(value) {
      return !isUndefined(value);
    }
    
  • Custom User Avatar

    So there are some more overrated kata:

    And many other kata with too big ranks.

  • Custom User Avatar

    Полная херня.
    Very bad code.

  • Custom User Avatar

    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.

  • Custom User Avatar
    const drop = i => xs => ...
    

    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?

  • Custom User Avatar

    All array methods will work with 'arguments' as well. There is no need to transform 'arguments' before using reduce.

    Array.prototype.reduce.call(arguments, function(a,b) {return a*b / gcd(a,b);}, 1);
    
  • Custom User Avatar

    You should definitely write some even more tricky random cases for js. I have passed all tests with this code.

  • Loading more items...