Kindly check this code why its not working

public void reverse(int k) throws Exception{

// Write your code here 
int l=0;
int s=k-1;
while(s<this.size){
	int left =l;
	int right=s;
  while(left<right){
  Node nl = this.getNodeAt(left);
  Node ns = this.getNodeAt(right);
  int temp = nl.data;
  nl.data=ns.data;
  ns.data=temp;
  left++;
  right--;
  }
  l=l+k;
  s=s+k;

}
 
}

first i divide list int k elements list then i revese them simultaneously

Hi Ishant
Please post your doubt using “Ask Doubt” section of your online course and follow cb.lk/askdoubt guidelines to ask doubts.