Maximum Index GFG POTD Python Solution geeks for geeks problem of the day python solution

Pubblicato il: 04 marzo 2024
sul canale di: VS Code
357
5

Problem - https://www.geeksforgeeks.org/problem...

Given an array a of n positive integers. The task is to find the maximum of j - i subjected to the constraint of a[i] a[j] and i j.

Example 1:

Input:
n = 2
a[] = {1, 10}
Output:
1
Explanation:
a[0] a[1] so (j-i) is 1-0 = 1.
Example 2:

Input:
n = 9
a[] = {34, 8, 10, 3, 2, 80, 30, 33, 1}
Output:
6
Explanation:
In the given array a[1] a[7] satisfying the required condition(a[i] a[j]) thus giving the maximum difference of j - i which is 6(7-1)


In questa pagina del sito puoi guardare il video online Maximum Index GFG POTD Python Solution geeks for geeks problem of the day python solution della durata di ore minuti seconda in buona qualità , che l'utente ha caricato VS Code 04 marzo 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 357 volte e gli è piaciuto 5 spettatori. Buona visione!