How would you implement a linked list?
Asked in the technical phone interview stage. The candidate paraphrases this as one of two programming questions in the quant developer intern technical round.
Implement a singly linked list processor. Given operations, apply append, prepend, insert at a zero-based index, and delete the first matching value. Return the final list of values.
linked_list_operations(operations) receives a list of operation dictionaries. Each operation is {"op": "append"|"prepend", "value": integer}, {"op": "insert", "index": integer, "value": integer}, or {"op": "delete", "value": integer}. Insert indices are valid, and deleting a missing value does nothing.
def linked_list_operations(operations):