My k_Append solution is giving error of Class LinkedList

int n=this.size;
//int currnode=n-k+1;
Node curr=this.head;
Node prev=this.head;
int count=0;
for(int i=1;i<=n-k;i++) {
prev=curr;
curr=curr.next;

	}
	prev.next=null;
	Node temp=curr;
	while(temp.next!=null) {
		temp=temp.next;
		count++;
	}
	temp.next=this.head;

@karamjitverma89

  1. You have missed an important part of the question:
    Note that K can be greater than N.
    So, your code is failing for k=>N
    Example:
    7
    1 2 2 1 8 5 6
    8
    Expected Output:
    6 1 2 2 1 8 5
    Your Output:
    1 2 2 1 8 5 6

Observation:
The required output is the same as that of k=1.
Similarly,
for k=7 the output is the same as that of k=0.
for k=9 the output is the same as that of k=2.

Solution:
k = k mod n;
this would limit the value of k within the range [0,n-1]
Also, if k=0 or k= multiple of n then the linked list will be same.