Tap here to switch tabs
Problem
Submissions

Problem: Sort List

Sort List gives you the head of a linked list and asks you to return the same list with its values arranged in ascending order, including lists that contain negative values.

Statement

Given the head of a linked list, return the list after sorting it in ascending order.

Constraints:

  • The number of nodes in the list is in the range [0,1000][0, 1000].
  • −103≤-10^3 \leq Node.value ≤103\leq 10^3
⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sort List

Sort List gives you the head of a linked list and asks you to return the same list with its values arranged in ascending order, including lists that contain negative values.

Statement

Given the head of a linked list, return the list after sorting it in ascending order.

Constraints:

  • The number of nodes in the list is in the range [0,1000][0, 1000].
  • −103≤-10^3 \leq Node.value ≤103\leq 10^3