You are given four integers. Your task is to determine and return the second largest value among them.
The numbers may contain duplicates, so the second largest value can be equal to the largest value if the maximum occurs more than once.
Input: a = 3, b = 9, c = 7, d = 5
Output: 7
Explanation: The largest value is 9, and the second largest value is 7.
Input: a = 10, b = 10, c = 4, d = 2
Output: 10
Explanation: The largest value 10 occurs twice, so the second largest value is also 10.
Input: a = 1, b = 2, c = 3, d = 4
Output: 3
Explanation: The numbers in descending order begin with 4, 3, making 3 the second largest value.
Sign in to write, run, and submit your solution against the full test suite.