Regarding rainwater problem

what will be the code for creating left precomputed array?

initialize left_arr[n];
left_arr[0]=arr[0];
for(int i=1;i<n;i++)
{
left[i]=max(left[i-1],arr[i]);
}