Debug the non-decreasing to nonincreasing