Skip to content
Onsite

Second Maximum of Three Numbers

EasyP3Coding

Return the middle value of a, b and c: the one that is neither the largest nor the smallest. If two values are equal, the middle value is determined by sorting, so [5, 5, 1] gives 5.

Example 1

Input
a = 3, b = 1, c = 2
Output
2

Example 2

Input
a = 1, b = 2, c = 3
Output
2

Example 3

Input
a = 5, b = 5, c = 1
Output
5

Constraints

  • -10^9 <= a, b, c <= 10^9

Hints

Run checks the 3 visible tests, Submit all 8.