verified code for FindMinInRotatedArray