iterative solution for finding min value from rotated array