Given an unsorted array, return the element that is neither the maximum nor the minimum value.
Step 1 : I first explain the approach to solve the problem in brute force approach which is by sorting the array.
Step 2: then i optimized it by iterating each element one time to find maximum and minimum of the array.
Step 3 : return the element which is neither maximum nor minimum.
Step 4: Then I also explained the time complexity.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is the purpose of the return keyword?