Lefttoright maxima in Dyck bridges and walks