Insert node in linked list hackerrank solution