FreeWheel systems may maintain ordered in-memory lists of campaign items before processing. Implement a singly linked list that supports inserting an item at the beginning, at the end, or at a zero-based index.
Create Node and LinkedList structures inside linked_list_operations. Process each operation in order and return the list values after all operations are complete.
The function receives operations, a list of operation arrays:
["insert_first", value] inserts value at index 0.["insert_last", value] appends value to the list.["insert_at", index, value] inserts value before the current item at index. Inserting at index == size appends the value.Return a standard Python list containing the final values in order. Every index is valid, and values are integers. The linked list must maintain both head and tail references.
def linked_list_operations(operations):