// Definition for singly-linked list. struct SinglyListNode { int val; SinglyListNode *next; //Constructor SinglyListNode(int x) : val(x), next(NULL) {} };