Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • Profile-pic

    55 and no more ideas :(

  • 16988960?v=4
  • Profile-pic

    This one is probably shortest but it's really expensive for computer as we are building array & string on each iteration.

  • 21692852?v=3

    Ah okay. This is actually an example of where grammar and semantic ambiguity threw me off. I read it right the first time, then the second time I didn't. Ignore the previous comments ;)

  • 31668662?v=4

    My O(n) solution passes in 3.5 sec.

    This is the overall time - my solution + my reference. Therefore, the user's code has to pass in 10 sec, it can be almost 7 times slower than my solution and still work.

    But you just said you tweaked it so O(n^2) solutions pass...

    I never said that they pass all tests, I said that they pass less tests now. After your tweak O(n^2) code would pass around 110/150 of the most intensive tests, while now they pass only 100/200.

  • 31668662?v=4

    My O(n) solution passes in 3.5 sec. If somehow somebody's O(n) solution doesn't pass having 10 seconds(!), then the code is bad.

  • 21692852?v=3

    "It's okay, I tweaked it a little so O(n^2) solutions now pass less tests with execution time staying fairly low."

    The point of this kata was so that O(n^2) solutions do not pass, but O(n) (even slow ones) do.

  • 21692852?v=3

    Maybe that should be mentioned in the desc. The bigint library should raise the difficulty of the kata as little as possible over the other languages.. hm.

  • 31668662?v=4

    It's okay, I tweaked it a little so O(n^2) solutions now pass less tests with execution time staying fairly low.

    Yeah, some operations in bignumber.js library are very different in speed. Division w/ floor is very slow compared to division w/o floor. And rounding with toPrecision() or toFixed(0) is very fast compared to toString(10). After these 2 changes my code became around 6 times faster O_o

  • 1228739?v=3

    Thanks, that was the hint I needed: bigNumber.toFixed(0).

  • 31668662?v=4

    Don't touch the JS version anymore. It's in ideal state now.

    The solution I used initially is bad and it indeed does not pass the tests anymore. For rounding use .toFixed(0), it's A LOT faster than toString(10).

  • 32236948?v=4

    because they have extra memory available, and a bit more efficient cpu usage (not much on this side). So on performances requirement, especially on the memory side, that can sometimes make the difference between "GNAAA I'm banging my head against the wall!! GNAAAA!!" and "well, that passed..."

  • 21692852?v=3

    I'm not unfortunately :/ Why do you ask?

  • 1228739?v=3

    Are you, by chance, a "Codewars Red" member?

  • 21692852?v=3

    I think I might have accidentally tightened the JS requirements after Farakusu did without realizing he'd already done so (it was to fix an issue where N^2 could pass). Give me a minute...

  • Loading more items...