Easy to understand accepted java solution

public class Solution {

public ListNode rotateRight(ListNode A, int B) {
    // Build cyclic list
    ListNode current = A;
    int size = 1;
    while(null != current.next){
        size++;
        current = current.next;
    }
    current.next = A;
    
    int count = size - (B % size);
    while(count-- > 0){
        current = current.next;
    }
    ListNode start = current.next;
    current.next = null;
    return start;
}

}

Click here to start solving coding interview questions