public static LinkedListNode rotateByKNodes(LinkedListNode head, int k)
    {
        if (head == null || k == 0)
        {
            return head;
        }
        
        LinkedListNode current = head;
        
        int count = 1;
        while (count < k && current != null)
        {
            current = current.getNext();
            count++;
        }
        
        if (current == null)
            return head;
        
        LinkedListNode kthNode = current;
        
        while (current.getNext() != null)
        {
            current = current.getNext();
        }
        
        current.setNext(head);
        head = kthNode.getNext();
        kthNode.setNext(null);
        
        return head;
    }