public static DoublyLinkedList reverse(DoublyLinkedList head){
        if(head == null) return null;

        DoublyLinkedList tmp = null;
        DoublyLinkedList curr = head;
        while(curr != null){
            tmp = curr.prev;
            curr.prev = curr.next;
            curr.next = tmp;
            curr = curr.prev;
        }
        return tmp.prev;
    }