Given a linked list represented as an array nums (head first), remove every node that has a node with a strictly greater value anywhere to its right. Return the values of the remaining nodes in order. The input is JSON {nums}.
Input: JSON {nums}.
Output: Array — the remaining node values.
Input: {"nums":[5,2,13,3,8]}
Output: [13,8]
Explanation: 5 and 2 have 13 to the right; 3 has 8.Input: {"nums":[1,1,1,1]}
Output: [1,1,1,1]
Explanation: None have a greater to the right.Input: {"nums":[9]}
Output: [9]
Explanation: Single node.1<=n<=10^5