You are given an array A of size N. You have to form all the sub-arrays possible having a size greater than or equal to 2. You have a "sum" variable initialized as 0. For each sub-arrays, Find the second largest element of the sub-array. Add it to the "sum" variable. Print the final value of "sum". Note: A sub-array is an array that can be formed by deleting some elements from the start and end of the given array A. Fo example: [1, 4) is a sub-array of [2, 1, 4, 3] and [2, 4] is not Constraints 2SN 33 10^5 . 15A_ISN • Elements in the array are pairwise distinct. Input Format • First line contains an integer N. • Second line contains N spaced pairwise distinct integers denoting elements of array A, .
Answers
Answered by
0
Answer:
very very big question
Explanation:
don't understand sorry
Similar questions