結果 : check if array is sorted leetcode solution