Can u tell me what is wrong with this piece of Code
why test cases are not passing
public void appendLastN(int n) throws Exception {
Node slow = this.head;
Node fast = this.head;
Node prev = null;
for (int i = 1; i <= n; i++) {
fast = fast.next;
}
while (fast != null) {
prev = slow;
slow = slow.next;
fast = fast.next;
}
Node temp = this.head;
this.head = slow;
this.tail.next = temp;
this.tail = prev;
this.tail.next = null;
}