Write a function to delete a node from a Singly Linked List.
public Node deleteNode(Node head, int d){ Node node = head; if(node.data == d) return head.next; while(node.next! = null){ if(node.next.data == d){ node.next = node.next.next; return head; } node = node.next; } }