Company: Bree_7oct
Difficulty: medium
Second next greater element Problem Description You are given an array A of size N and an integer X. For each element, Aᵢ, find the value of the second next greater element by X to the right. Notes: Nested indexing is followed: Second next greater element by X for any element Aᵢ is defined as the value of the element Aⱼ (i < j) such that A[i] + X < A[j] and there exists exactly one index k such that A[i] + X < A[k] where (i < k < j). Complete the function solve . This function takes the following 3 parameters and returns an array of N integers where iᵗʰ integer is denoting the value of the second next greater element by X to the right of A[i]. Parameters: N: Represents an integer denoting the size of array A X: Represents an integer denoting X A: Represents an integer array denoting A Input format for custom testing Note: Use this input format if you are testing against custom input or writing code in a language where we don't provide boilerplate code. The first line con