I must sort the subarray before comparing