in the given editorial for loop why we use 2*n-1
Find the greatest element
we are kind of adding the same array twice, so total elements equal to 2*n and last index =n-1.
You can add the same array twice and then run the normal greatest element but make sure to handle the indexes .