Q Agency Interview Question

Write a function to reverse a linked list.