Commiting a code to find maximum and minium in an array