Ad
  • Custom User Avatar

    How is it different from the mathematical definition?

  • Custom User Avatar

    Yeah I was planning on editing it once I finish - I'm so close.

    And yeah, it's bulky - but since the tests are looking for a very specific error wording, there is no way to complete his kata without digging through these discussions.

    Edit: Completed :D

  • Custom User Avatar

    Well, the kata is available for edit, and you're over 6k honor so you can add those in the descriptions yourself (it'll make you forfeit if you haven't completed the kata though).

    If I ended up finishing this kata in the next few days I'll probably do this myself.

    Though in my opinion the description is already very bulky. Not sure if adding even more stuff is a good idea.

  • Custom User Avatar

    How have these details not made it into the kata after 3 years?! How are we supposed to know the exact wording for the errors?

  • Default User Avatar

    Use Regex.escape

  • Default User Avatar

    Here is my trick / helper function to escape any string so that it can be used in RegExes:

    function resc(str){
       return escape(str).replace(/%u/g,'\\u').replace(/%/g,'\\x');
    }
    

    It's a little hacky in that it uses escape and that gets dropped once Google's crawler says "nobody uses it anymore", but if it stays in use that may never happen. Also I felt like it's more elegant than doing charCodeAt, converting to hex, then padding to 4 chars and finally prepending '\\u' for every single character, so yeah...

    My solution isn't purely RegEx-based (and passes all your test cases), but modifying the current top solution to use resc (also change square brackets into parentheses, join with | and change $1 into $2) makes 2)-4) work without a problem. You'd still have to remove \n from the comment markers to make 1) work, of course.

  • Custom User Avatar

    Cool. Thanks.

  • Custom User Avatar

    Is this still a problem?

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Hi, Can you please advice the best way for testing it? Thanks in advance.

  • Default User Avatar

    I think the description you just gave is much much better then the official one, Ryando.

  • Custom User Avatar

    Well it's not that straightforward. Your task is to check if the word is completely made up by combining words from the dictionary. So if dict=['code', 'wars'], combining the 2 words, we have 'codewars', while 'codewar' is impossible. Is it clearer for you?

  • Custom User Avatar

    This is the first one I've had to skip because what's being asked for in the description doesn't SEEM to match what the tests expect. Something doesn't make sense. Others seem to be on the right track, so...? Seemed straightfoward: are any of the words in the dictionary present in the given string? I'd enjoy having this clarified, if my interpretation is wrong. :P

  • Custom User Avatar

    Y is most definitely a vowel where I come from. It is pronounced as a vowel in words such as happY, todaY, rhYthm, sYllable, manY, analYse and many others.

    Since this is a JavaScript test and not a test of specialized knowledge of english phonetics, I think it should be at least mentioned in the task description, if not omitted from test cases.

  • Custom User Avatar

    Disemvoweling usualy just removes aeiou, and leaves y unaffected. I don't think Codewars currently has a ranking high enough to do justice to the problem of reliably detecting whether a given "y" is a vowel or a consonant (unless you include a phonetic dictionary in your solution) in English words.

    As of 2007 the state of the art for letter-to-phoneme conversion was only managing about 72% accuracy. Detecting the vowelness of a "y" is only a subset of that problem, but it should give you an idea of what you'd be up against.

    This is meant to be quick little challenge to do something practical, not a PhD thesis.

  • Loading more items...