arr = [] arr.push gets arr.push gets puts arr.sort.reverse == arr ? 'YES' : 'NO'