Ad
  • Custom User Avatar

    Ah, that's one I didn't expect. Thanks for the reply!

  • Custom User Avatar

    This pretty much sums up what I would have suggested. The suggestion for edge cases is something I would like to see more in katas - it really helps to constantly be aware of unusual cases in real life!

  • Custom User Avatar

    One more thing, your descriptions of factorise2 and factorise3 are lacking. I took a lucky guess and assumed you wanted an array of multiples of all the same prime factors for factorise3, but even now, I don't know if that's what you intended for the readers. You might want to add a bit more explanation for both functions.

    Here's a suggestion for factorise2:
    factorise2(n) returns an array of arrays, where the first is an array of unique prime factors of n in the ascending order and the second an array of how many times each unique prime factor occurs. Ex. factorise2(1000) returns [[2,5],[3,3]].

  • Custom User Avatar

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

  • Custom User Avatar

    Same error after disabling Docker. Any other advice?

    Really was looking forward to finishing this kata..

    EDIT: Never mind! Apparently I just had to wait a few minutes. :-)

  • Custom User Avatar

    Does this error occur if I'm using regex?

    /codewars/frameworks/javascript/cw-2.js:135
                return out.replace(new RegExp('\n', 'g'), '<:LF:>');
                                   ^
    TypeError: undefined is not a function
        at Object.Test.format (/codewars/frameworks/javascript/cw-2.js:135:32)
        at Object.Test.handleError (/codewars/frameworks/javascript/cw-2.js:237:48)
        at Object.Test.handleError (/codewars/frameworks/javascript/cw-2.js:227:26)
        at [eval]:3:6
        at Object. ([eval]-wrapper:6:22)
        at Module._compile (module.js:456:26)
        at evalScript (node.js:536:25)
        at startup (node.js:80:7)
        at node.js:906:3
    

    The funny thing is...I'm not using regex. Halp?

  • Custom User Avatar

    Please update the tests to use assertEquals. My submission is failing on one of the tests, but I have no clue what's wrong with it.

    I assume it has to do with one of these special cases:

    • the 25th character is the first letter of a word
    • the first character of a new line is a space
    • the 26th character is a space

    Nothing was mentioned about these in the prompt, but again, I have no clue if that is where it's failing.

    Please, for the sake of all of us, use something other than expect.

  • Custom User Avatar

    I'm getting an odd error under norm test, but it passes all of my hand-written tests.

    Dot Product
    Expected: 26, instead got: {"components":[null,null,null],"length":3}
    Expected: {"components":[null,null,null],"length":3}, instead got: {"components":[null,null,null],"length":3}
    

    Any clue why it might do that?

  • Custom User Avatar

    I'm not sure if the implementation of random tests really make sense to me.
    Others, including myself, have had issues with modifying available resulting in bogus expected output for random tests. The reason being: the expected output is being calculated after cakes() has been run once.

    A better way to do it would be to compute the expected output beforehand, save it to a variable, and check against the pre-computed expected output.

    Is this a reasonable change to suggest? I would appreciate any opinions the community has on this.