If the current wall is taller than the previous wall then make current wall as the previous wall and its index as previous wall 's index  for the subsequent loops
if ( arr [ i ] >= prev ) { prev = arr [ i ] ; prev_index = i ;