Company: EPAM__
Difficulty: medium
2. Linked a Linked List Problem Statement You are given an array of size n . You have to create a new linked list with exactly n / 2 nodes. The value of each node of the new list is the mean of a pair of elements taken from the given array: the first node holds the mean of the smallest and the largest value of the array, the second node holds the mean of the second smallest and the second largest value, and so on, until every element of the array has been used exactly once. The mean of two integers a and b is (a + b) / 2 using floor division. Input Format The first line contains an integer n , the size of the array. The next n lines each contain one integer, an element of the array. Output Format Print the values of the new linked list from head to tail on a single line, joined by the four-character separator " -> " (a space, a hyphen, a greater-than sign and a space). For an array of size n this prints exactly n / 2 values. Constraints 1 < n <= 2000 n is always even 1 <= a