#K82957. Second Tallest Height Problem
Second Tallest Height Problem
Second Tallest Height Problem
You are given several test cases. In each test case, you are provided with an integer N followed by N integers representing the heights of individuals. Your task is to determine the second tallest unique height for each test case.
In other words, after removing duplicate height values, sort the remaining heights in descending order and print the second value. It is guaranteed that each test case contains at least two distinct height values.
The output for each test case should be formatted as Case #i: X
, where i
is the test case number (starting from 1) and X
is the second tallest height.
inputFormat
The first line of input contains an integer T denoting the number of test cases. For each test case, the first line contains an integer N indicating the number of heights, followed by a line with N integers separated by spaces, representing the heights.
outputFormat
For each test case, output a single line in the format: Case #i: X
, where i
is the test case number (starting from 1) and X
is the second tallest unique height.
1
5
4 2 7 5 6
Case #1: 6
</p>