class Solution { // Function to reverse a circular linked list Node reverse(Node head) { if (head == null || head.next == head) return head; // code here if (head == null || head.next == head) return head; // Find the last node to break the circular reference Node prev = null; Node curr = head; Node next = null; // Reverse the list while keeping track of the last node do { next = curr.next; //first we are updating next curr.next = prev; //Reverse the direction of the current prev = curr; //Update prev to curr curr = next; //update curr to next } while (curr != head); // Link the last node to the new head head.next = prev; return prev; // Return the new head of the reversed list } ===================================================================== // Function to delete a node from the circular linked list Node deleteNode(Node head, int key) { // code here Node curr=head.next; Node prev=head; if(head.data==key){ while(curr.next!=head){ curr=curr.next; } curr.next=head.next; return head.next; }else{ while(curr!=head){ if(key==curr.data){ prev.next=curr.next; break; } prev=curr; curr=curr.next; } return head; } } } =============================================================================