You are viewing a single comment's thread. Return to all comments →
Typescript
function migratoryBirds(arr: number[]): number { let result = 1; let counter = [0, 0, 0, 0, 0] as number[]; for (let ele of arr) { counter[ele - 1] += 1; } let max = counter[0]; for (let i = 0; i < counter.length; i++) { if (counter[i] > max) { max = counter[i]; result = i + 1; } } return result; }
Seems like cookies are disabled on this browser, please enable them to open this website
Migratory Birds
You are viewing a single comment's thread. Return to all comments →
Typescript