Given a singly linked list and an integer, x, remove nodes greater than x.
List = 95 → 121 → 29
x= 96 List becomes 95 → 29
Return a reference to the root node of the list after removing 121.
Function Description
Complete the function removeNodes in the editor below.
The function must return a reference to the root node of the final list.
removeNodes has the following parameter(s):
node listHead: a reference to the root hode of the singly-linked list
int x: integer, the maximum value to be included in the returned singly-linked list
Returns:
node: a reference to the root node of the final list console ```
Constraints
• 1 5n, x < 121
• 1 5 SinglyLinkedListNode values < 121