2487. Remove Nodes From Linked List
Medium
Previous2486. Append Characters to String to Make SubsequenceNext2491. Divide Players Into Teams of Equal Skill
Last updated
Medium
Last updated
You are given the head
of a linked list.
Remove every node which has a node with a strictly greater value anywhere to the right side of it.
Return the head
of the modified linked list.
Example 1:
Example 2:
Constraints:
The number of the nodes in the given list is in the range [1, 105]
.
1 <= Node.val <= 10^5
ε η¨ stack ζΆε»ζ― head ε°ηη―ι»οΌζ₯θε° stack ε §ε©δΈηη―ι»ι£ε¨δΈθ΅·γ