3 ms·
One mistake I made: after the first traversal over the linked-list the character in the head node of the remaining list is not necessarily the first non-repeat
by spaghetti 15y ago
One mistake I made: after the first traversal over the linked-list the character in the head node of the remaining list is not necessarily the first non-repeated character. Consider the string "aba" for example. However the second traversal will be over a shorter list... So this approach might get you somewhere :-)