2 ms·
Yes, first non-repeated, my bad. The usually in the middle is meant to say that typically the first character returned is position ~s.length/2. The linked lis
by kenjackson 15y ago
Yes, first non-repeated, my bad.
The usually in the middle is meant to say that typically the first character returned is position ~s.length/2.
The linked list idea is good. I wasn't thinking of that at all.
- spaghetti 15y agoOne 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 :-)