Question: iwh for the eament a t inder 2 ( M v i c h i s 5 ) i s 4 , and the dotance
iwh for the eament inder and the dotance
alk follows based inaeving
function description
Complete the distanceToGreaterleft function in the editor below. It has the following parameters:
Name
Type
Description
N
INTEGER
The size of array A
A INTEGER ARRAY The given array.
idx INTEGER
The index of the element of interest in A
The function must return an INTEGER denoting the distance from the
Return element at idx to its nearest greater element on the left. If no such element exists, it should return
Constraints
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
