Linked List • Easy

Reverse Linked List

Given the head of a singly linked list, reverse the list, and return the reversed list.

The Challenge

Given the head of a singly linked list, reverse the list, and return the reversed list.

Difficulty Easy
Topic Linked List

Pro-tip: Use three pointers: prev, current, and next to iterate and flip the arrows.

Solution.swift Tests.swift
Output
Ready to run.