corrected minimum function to handle odd lengths