implement leftmost minimum elements exercise