arrow_back Back to Challenges

#148 Sort List

Medium Acceptance 0%
description

Problem Description

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

checklist Constraints

The number of nodes in the list is in the range [0, 5 * 10^4].
-10^5 <= Node.val <= 10^5

science Examples

Case #1

In: head = [4,2,1,3]
Out: [1,2,3,4]

Case #2

In: head = [-1,5,3,4,0]
Out: [-1,0,3,4,5]

Mastery Tags

Linked List Sorting

Hiring Companies

Amazon Google Meta
code

Integrated IDE

code_blocks
Coding
psychology
Aptitude