60: Reverse linked list

Given a linked list, return a reversed one

 

Example 1

Input:  1 -> 2 -> 3 -> null

Output: 3 -> 2 -> 1 -> null

Example 2

Input:  1 -> null

Output: 1 -> null
Difficulty:Easy
Topic:Linked list
Problem #:60