Current building paired with the building greater in height and on the extreme right
int right = 0 ; if ( maxIndSoFar > pairs [ i ] . ind ) { right = ( pairs [ i ] . val * ( maxIndSoFar - pairs [ i ] . ind - 1 ) ) ; }