161. Reverse Linked List

EasyLinked List

Given the head of a singly linked list, reverse the list, and return the reversed list. Input/output is given as an array representation of the linked list.

Examples

Input: [1,2,3,4,5]

Output: [5,4,3,2,1]

Explanation: Public test case for Reverse Linked List

Constraints

  • 0 <= n <= 5000
  • -5000 <= Node.val <= 5000
Loading...

Run checks all cases above. Submit evaluates all test cases.