Rosh - Compute sum of the third-largest and second-smallest elements from a list of integers
Single File Programming Question
Problem Statement
Rosh is intrigued by numerical patterns. Today, she stumbled upon a puzzle while working with arrays. She wants to compute the sum of the third-largest and second-smallest elements from a list of integers. She seeks your help to implement a program that solves this for her efficiently.
Input:
format :The first line of input is an integer N, representing the size of the array. The second line of input consists of N space-separated integers, representing the elements of the array.
Output:
format :The output displays a single integer representing the sum of the third-largest and second-smallest elements in the array. Refer to the sample output for the formatting specifications. Code constraints : The given testcases fall under the following constraints: 3 ≤ N ≤ 50 1 ≤ elements ≤ 100 Sample test cases :
Input 1:
10 10 20 30 40 50 60 70 80 90 100
Output 1 :
100
Input 2 :
5 98 1 54 36 82
Output 2 :
90
Input 3 :
3 10 28 47
Output 3 :
38