Find the Middle Value Among Three Distinct Numbers
Basic Acceptance 84.12% Points 10.00
You are given three distinct integers. Your task is to return the value that is neither the largest nor the smallest.
Examples
Example 1
Input: a = 3, b = 9, c = 5
Output: 5
Explanation: 5 lies between 3 and 9.
Example 2
Input: a = 10, b = 2, c = 6
Output: 6
Explanation: 6 is the median of the three values.
Example 3
Input: a = 1, b = 3, c = 2
Output: 2
Explanation: 2 is the middle value.
Constraints
- -109 <= each number <= 109
- All three numbers are distinct.
Companies
Google Media.net
Topics
Data Structures Basics Comparisons
Track your submissions
Please log in to review your progress and explore code submissions from other participants.
Unlock the full solution
Please log in to access detailed answers and explanations.
Join the discussion
Please log in to join conversations with other participants.