Y is my code not running?

public void reverse(int k) throws Exception{
if(size==0){
throw new Exception(“empty ll”);
}
else if(size==1){
throw new Exception(“single node exists reverse not possible”);
}
else{
int len=size/k;
int left=0;
int right=k-1;
for(int i=0;i<len;i++){
while(left<right){
Node l=getNodeAt(left);
Node r=getNodeAt(right);
int temp=l.data;
l.data=r.data;
r.data=temp;
left++;
right–;
}
left=left+2;
right=left+(k-1);
}
}
}

please share your entire code…save it on ide.codingblocks.com and share the link

also in this ques it is easy to do by swapping the values but actually you have to swap the links

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.