Efficient data structure algorithms firstUniqueItem2 time complexity O(n). firstUniqueItem time complexity O(n log n). reverseString time complexity O(n) and space complexity(1).