Your question is Linked List Implementation. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The international advanced analytics data platform needs an in-memory sequence structure for workloads with frequent insertions and removals at both ends. Implement a mutable doubly linked list and process a sequence of commands while preserving correct head, tail, and length invariants.
Write process_linked_list(operations), where operations is a list of command arrays. Return a list containing results only for commands that produce output:
['append', value]: Add value to the end.['prepend', value]: Add value to the beginning.['insert', index, value]: Insert at index, returning true if valid and false otherwise.['get', index]: Return the value at index, or null if invalid.['delete', index]: Remove and return the value at index, or null if invalid.['pop_front'] and ['pop_back']: Remove and return an end value, or null when empty.['reverse']: Reverse the list in place.['length']: Return the current number of elements.Values are integers. Indexing is zero-based. insert accepts indices from 0 through the current length.
def process_linked_list(operations):