Ad
  • Custom User Avatar

    JS fork 🤖🤖🤖

    • updated to node 18
    • reduced maximum input so the expected result never exceed Number.MAX_SAFE_INTEGER resolving this issue
    • used mocha/chai assertions + lodash for randomness
    • made description language-agnostic
    • provided input on failure
  • Custom User Avatar

    Tests in JavaScript go beyond MAX_SAFE_INTEGER:

    • last test of theharder tests block:

      Test.assertEquals(solution(200000000), 9333333166666668);
      // 9333333166666668 <-- expected
      // 9007199254740991 <-- MAX_SAFE_INTEGER
      
    • RNG in the random tests:

    const num = ~~(Math.random() * 200000000)