algorithm to find the maximum difference of j - i such that a[j] > a[i], for a given an array of 'n' elements.
Answers
Answered by
0
Input: {34, 8, 10, 3, 2, 80, 30, 33, 1}
Output: 6 (j = 7, i = 1)
Input: {9, 2, 3, 4, 5, 6, 7, 8, 18, 0}
Output: 8 ( j = 8, i = 0)
Input: {1, 2, 3, 4, 5, 6}
Output: 5 (j = 5, i = 0)
Input: {6, 5, 4, 3, 2, 1}
Output: -1
PLEASE MAKE ME AS A BRAINLIST ANSWER
Similar questions
Math,
5 months ago
Environmental Sciences,
5 months ago
Social Sciences,
5 months ago
English,
10 months ago
Biology,
10 months ago
French,
1 year ago
English,
1 year ago
Math,
1 year ago