結果 : check if array is sorted or rotated leetcode