Ad
  • Custom User Avatar

    OP solved it, closing. But with a terrible time complexity algorithm

  • Default User Avatar

    It actually works because the ascii offset should be 96 but by adjusting it to 95 you are adding one additional point for each letter; thus tracking the length implicitly via ascii value.

  • Custom User Avatar

    You're right, the length is ignored. I don't remember how I missed it, I solved this task a year ago. Apparently, the solution worked back then :)

  • Custom User Avatar

    You spotted correctly that he's ignoring length in his scoring. Which is incorrect, and the random tests mostly catch this. Which makes it amazing this is voted "Best Practice".

    Not that I should be throwing stones here .. :P I've made similar mistakes aplenty.

  • Custom User Avatar

    Which exactly part is not clear?
    Let's say we have a name "John". Then

    _ = 'John'
    _.toLowerCase() // => 'john'
    [..._.toLowerCase()] // basically casts the string to a list => ['j', 'o', 'h', 'n']
    // Then `reduce` converts the letters to numbers and sums them.
    
  • Default User Avatar

    I am sorry for you but the tests are correct. They are the same in all languages, 972 guys passed the kata (129 in JS).

  • Default User Avatar

    The tests and samples conform with the rules.