Finding the pivot element
Given an array of numbers ( minimum length 3), find an index such that all the elements to the left of it are less than or equal, and all the elements to the right of it are greater than it. For example in the array [1, 2, 3], the pivot element is 2, as all…