public ListNodes Method(ListNodes head, int val) { if (head == null) { return(head); } head.next = Method(head.next, val); return(head.val == val ? head.next : head); }
public ListNodes(int val = 0, ListNodes next = null) { this.val = val; this.next = next; }