Check this code for reverse k

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;}
  l=l+k;
  s=s+k;

}

exception are thrown for main method …

Hi Ishant,

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