Ad
  • Custom User Avatar

    @jean.pumarol, your solution is inefficient.

  • Custom User Avatar

    I know that you posted this some time ago. I had the same problem with memory overflow. I refactored my code and now I dont have that problem. But now I have an exit code, because of execution timeout. Did you finally solved it?

    ++++++function whoIsNext(names, r){
    ++++++let num = 0
    ++++++while((names.length + num) < r) {
    ++++++let name = names.shift()
    ++++++names.push(name, name)
    ++++++num += 1
    ++++++}
    ++++++return names[r-num-1]
    ++++++}

  • Custom User Avatar

    It seems it's a memory overflow problem. There are tests with long values.

  • Custom User Avatar

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

  • Custom User Avatar

    What a strange error message, I've just tested it with a couple of solutions and it works, try sharing your code in a post marked as having spoiler content so we can help you.

  • Custom User Avatar

    I believe this kata is broken for javascript.

    I've tried two solutions that work with each test passing. Yet I get an error in red in both cases:

    Log
    <--- Last few GCs --->

    3428 ms: Mark-sweep 1013.9 (1029.5) -> 610.6 (625.1) MB, 240.3 / 0.0 ms [allocation failure] [GC in old space requested].
    3626 ms: Mark-sweep 610.6 (625.1) -> 610.6 (625.1) MB, 197.5 / 0.0 ms [allocation failure] [GC in old space requested].
    3821 ms: Mark-sweep 610.6 (625.1) -> 610.6 (618.1) MB, 195.1 / 0.0 ms [last resort gc].
    4016 ms: Mark-sweep 610.6 (618.1) -> 610.6 (618.1) MB, 194.9 / 0.0 ms [last resort gc].
    

    <--- JS stacktrace --->

    ==== JS stack trace =========================================

    Security context: 0x3f47d93cf781
    2: whoIsNext [/home/codewarrior/index.js:~5] [pc=0x3d098205ff53] (this=0x235e1eecb801 ,names=0x313af0c91899 <JS Array[79300100]>,r=1000000000)
    3: /* anonymous / [/home/codewarrior/index.js:65] [pc=0x3d098205c09c] (this=0x235e1eecb801 )
    4: /
    anonymous */ [/runner/frameworks/javascript/cw-2.js:159] [pc=0x3d098205a1bc] (this=0x235e1eecb801 <JS Glob...
    STDERR: