Question: I got an input array = [ 6 , 5 , 4 , 1 , 3 , 2 ] and I want the output to

I got an input array =[6,5,4,1,3,2] and I want the output to be [5,4,3,3,2]
Following the condition:
1. From each value in the array, one by one, if the left value is bigger than the right value, replace it with right value.
2. In case that the value is smaller than both left value and right value, replace the middle value with the minimum of left value and right value.

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!