public static MyLinkedList nthToLast(MyLinkedList list, int k) {
    if (list == null || k < 0) {
      return null;
    }
    
    MyLinkedList p1 = list;
    MyLinkedList p2 = list; 
    
    for (int i = 0; i < k; i++) {
      if (p1 == null) {
        return null;
      }
      p1 = p1.getNext();
    }    
    while (p1 != null) {
      p1 = p1.getNext();
      p2 = p2.getNext();
    }   
    return p2;    
  }