• + 2 comments

    Nice one liner using the built in functions! Unfortunately, this still fails when k is higher than n (test case #4). You seem to be getting around it by overwriting k with:

    var k = details[1]%details[0];
    

    I'm curious to see if there are other, more algorithmic solutions to this in Javascript.