Node
y comenzamos nuestra DoublyLinkedList
. Agreguemos dos métodos a nuestra lista doblemente enlazada llamada add
y remove
. El add
método debe añadir el elemento dado de la lista, mientras que el remove
método debe eliminar todas las ocurrencias de un elemento dado en la lista. Tenga cuidado al manejar cualquier posible caso de borde al escribir estos métodos, como eliminaciones del primer o último elemento. Además, eliminar cualquier elemento de una lista vacía debe devolver null
.