Implement MyLinkedList, a 0-indexed singly linked list, without using a built-in list type. Support get(index), addAtHead(val), addAtTail(val), addAtIndex(index, val) and deleteAtIndex(index). get returns -1 for an invalid index; addAtIndex does nothing when index is greater than the length, and appends when it equals the length; deleteAtIndex does nothing for an invalid index.
Implement MyLinkedList, a 0-indexed singly linked list, without using a built-in list type. Support get(index), addAtHead(val), addAtTail(val), addAtIndex(index, val) and deleteAtIndex(index). get returns -1 for an invalid index; addAtIndex does nothing when index is greater than the length, and appends when it equals the length; deleteAtIndex does nothing for an invalid index.