Neat modulo function trick used, please check it

int Solution::maxArr(vector &A) {
int max1=INT_MIN;
int max2=INT_MIN;
int min1=INT_MAX;
int min2=INT_MAX;
int current1=0;
int current2 =0;
for(int i=0;i<A.size();i++)
{
current1 = A[i]-i;
current2 = A[i]+i;
if(current1 > max1)
{
max1=current1;;
}
if(current2 > max2)
{
max2=current2;
}
if(current1 < min1)
{
min1=current1;
}
if(current2 < min2)
{
min2=current2;
}

}
int abs1 = abs(max1-min1); 
int abs2 = abs(max2-min2);
if(abs1>abs2)
{
    return(abs1);
}
else
{
    return abs2;
}

}

Hey Shrut,
Can you please explain what is Neat Modulo function trick?

Click here to start solving coding interview questions