Implement a function to reverse a linked list, or simulate a memory allocator.
Asked in the C programming round stage. Choose one of the two tasks; this specification defines the linked-list option.
Implement reverse_linked_list(head), where head references the first node of a singly linked list. Each node has value and next fields. Return the new head after reversing all links. For examples and JSON tests, a list of values represents the linked list, and the expected output is the reversed list of values.
def reverse_linked_list(head):