function findChampions(statistics) {
//первым циклом пробегаемся по дням
 
function findChampions(statistics) {
//первым циклом пробегаемся по дням
//внутри еще цикл который пробегается по userId
// {
// 1: {steps: [1000],
// 2: steps: [1000, 2000],
// }
const days = {};
statistics.forEach((u, i) => {
days[i +1] = { steps: u.map(s => s.steps)}
});
return days
}
 
//Пример 1:
const statistics1 = [
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 1500 }],
[{ userId: 2, steps: 1000 }]
];
 
console.log("statistics1",findChampions(statistics1)); // { userIds: [2], steps: 2500 }
 
//Пример 2:
const statistics2 = [
[{ userId: 1, steps: 2000 }, { userId: 2, steps: 1500 }],
[{ userId: 1, steps: 3500 }]
];
 
console.log("statistics2", findChampions(statistics2)); // { userIds: [1], steps: 5500 }
 
//Пример 3:
const statistics3 = [
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 1000 }],
[{ userId: 1, steps: 1000 }, { userId: 2, steps: 1000 }]
];
 
console.log("statistics3",findChampions(statistics3)); // { userIds: [1, 2], steps: 2000 }
 
//Пример 4:
const statistics4 = [
[
{ userId: 1, steps: 1000 },
{ userId: 2, steps: 1000 },
{ userId: 3, steps: 1000 },
{ userId: 4, steps: 1000 },
{ userId: 5, steps: 1000 }
],
[
{ userId: 1, steps: 2000 },
{ userId: 2, steps: 2000 },
{ userId: 3, steps: 1500 },
{ userId: 4, steps: 1500 },
{ userId: 5, steps: 2000 }
],
[
{ userId: 1, steps: 1500 },
{ userId: 2, steps: 1500 },
{ userId: 3, steps: 2000 },
{ userId: 4, steps: 2000 },
{ userId: 5, steps: 1500 }
],
[
{ userId: 1, steps: 1000 },
{ userId: 2, steps: 1000 },
{ userId: 3, steps: 1500 },
{ userId: 4, steps: 1500 },
{ userId: 5, steps: 1000 }
],
[
{ userId: 1, steps: 3000 },
{ userId: 2, steps: 3000 },
{ userId: 3, steps: 2000 },
{ userId: 4, steps: 2000 },
{ userId: 5, steps: 3000 }
]
];
 
console.log("statistics4",findChampions(statistics4)); // { userIds: [1, 2, 5], steps: 8500 }
 
//Пример 5:
const statistics5 = [
[
{ userId: 1, steps: 1000 },
{ userId: 2, steps: 1500 }
],
[
{ userId: 1, steps: 2000 },
{ userId: 2, steps: 1000 },
{ userId: 3, steps: 1800 }
],
[
{ userId: 1, steps: 1500 },
{ userId: 2, steps: 1500 },
{ userId: 4, steps: 1000 }
],
[
{ userId: 1, steps: 1000 },
{ userId: 2, steps: 2000 },
{ userId: 3, steps: 1200 }
],
[
{ userId: 1, steps: 3000 },
{ userId: 2, steps: 1000 },
{ userId: 4, steps: 2000 }
]
];
 
console.log("statistics5", findChampions(statistics5)); // { userIds: [1], steps: 8500 }
 
Click Run to execute JavaScript.
Code runs in an isolated environment.