Chevaux de course

qu’est ce qui ne va pas avec mon code ?

const N = parseInt(readline());

var chevaux = [];
for (let i = 0; i < N; i++) {
    const pi = parseInt(readline());
    chevaux.push(pi);
};

var diff = chevaux.sort((a,b) => a-b)

                    .map((current, index, array) => current - array[index-1])

                    .slice(1)

                    .sort((a,b => a-b));

                    

console.log(diff[0]);

A post was merged into an existing topic: Horse Racing Duals puzzle discussion