public ListNode rotateRight(ListNode head, int n) {
        if(head == null) return null;
        int len = 1;
        ListNode temp = head, tail = head;
        for( ; tail.next != null; tail = tail.next) len++;
        
        n %= len;
        if(n == 0) return head;
        n = len - n;
        
        for(int l = 1; l < n; l++) temp = temp.next;
        
        tail.next = head;
        head = temp.next;
        temp.next = null;
        return head;
    }