https://practice.geeksforgeeks.org/problems/reverse-a-doubly-linked-list/1

Node *reverseDLL(Node *head) {
  Node *temp = nullptr;
  Node *curr = head;

  while (curr != nullptr) {
    temp = curr->prev;
    curr->prev = curr->next;
    curr->next = temp;
    curr = curr->prev;
  }

  if (temp != nullptr)
    head = temp->prev;

  return head;
}