HackerRank: Migratory Birds (Easy)
Link to code challenge Naive approach. function migratoryBirds(arr) { let num = Infinity; let count = 0; let largestCount = 0; let newArr = arr.sort(); for (let i = 0; i largestCount) { largestCount = count; num = newArr[i - 1]; } //DON'T need this else if statement since newArr[i - 1] will always be greater than num as the arr is in numerical order else if (count === largestCount) { if (newArr[i - 1]