public MyLinkedList GetNode(int index) { if (index < 0) { return(this); } int i = 0; MyLinkedList currNode = this.Next; while (i < index) { if (currNode != null) { currNode = currNode.Next; } else { break; } i++; } return(currNode); }
public MyLinkedList(int val, MyLinkedList next) { this.Val = val; this.Next = next; }
public MyLinkedList() { this.Val = -1; this.Next = null; }