an optimization for problem: 12.5 Longest Substring Without Repeating Charac...

With the optimization, it just need visit elements in the array once.