Tap here to switch tabs
Problem
Submissions

Problem: Remove Nodes From Linked List

Try to solve the Remove Nodes From Linked List problem.

Statement

You are given the head of a singly linked list.

Remove every node that contains a node with a strictly greater value anywhere to its right.

Return the head of the modified linked list.

Constraints:

  • The number of nodes in the given list is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Remove Nodes From Linked List

Try to solve the Remove Nodes From Linked List problem.

Statement

You are given the head of a singly linked list.

Remove every node that contains a node with a strictly greater value anywhere to its right.

Return the head of the modified linked list.

Constraints:

  • The number of nodes in the given list is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤105\leq 10^5