Added optimized solution for checking unique characters in a string