...

/

Sort List

Sort List

Try to solve the Sort List problem.

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.data 103\leq 10^3

Examples

Access this course and 1400+ top-rated courses and projects.