• + 0 comments

    js my solution... if (n == c.length) return 0;

    const lengthC = c.length - 1;

    c.sort((a, b) => a - b); console.log(c);

    let max = c[0]; for (let i = 0; i < lengthC; i++) { const tmp = Math.floor(c[i + 1] - (c[i + 1] + c[i]) / 2);

    if (tmp > max) max = tmp; }

    let lastOne = n - c[lengthC] - 1;

    if (lastOne > max) max = lastOne;

    console.log(max);