Given a linked list, determine whether it is sorted. Return "ascending" if it is non-decreasing, "descending" if it is non-increasing, "both" if it is constant (or has 0/1 nodes), and "neither" otherwise.
Input: An array of node values.
Output: Quoted string — one of ascending/descending/both/neither.
Input: [1,2,3,4]
Output: "ascending"
Explanation: Non-decreasing.Input: [4,3,2,1]
Output: "descending"
Explanation: Non-increasing.Input: [5,5,5]
Output: "both"
Explanation: Constant counts as both.0<=n<=10^5-10^9<=value<=10^9