Question: An intern at HackerRank is assigned to finding the optimal middle subsequence. An optimal middle subsequence is the subsequence chosen of length 3 chosen from

An intern at HackerRank is assigned to finding the optimal middle subsequence. An optimal middle subsequence is the subsequence chosen of length 3 chosen from an array arr, such that chosen[0]< chosen[1]> chosen[2] and that the sum of its elements is the minimum possible. Given an array, return the sum of the values of the optimal middle subsequence. If there is none, return -1.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!