Menu
Coddy logo textTech

Second Most Popular

Lesson 3 of 3 in Coddy's Interview Coding Challenges - Pack I course.

challenge icon

Challenge

Hard

Write a function named secondMost that gets a list of integers as an input, and returns the second most recurring integer.
For example,

Input:

[98, 72, 93, 72, 83, 98, 72, 44, 25, 53, 43, 98, 81, 98]

Expected output:

72

Explanation - 72 is included 3 times in the list, right after 98, which is included 4 times. therefore 72 is the second most popular number.

Try it yourself

int secondMost(int* a, int n) {
    // Write code here
}

All lessons in Interview Coding Challenges - Pack I

1Challenges

Merge SortAlmost PalindromeSecond Most Popular