Company: Amazon_Scientist_27sep
Difficulty: medium
First Unique Character in a String Problem Description Amazon Web Services is experimenting with optimizing search queries based on the location of the first unique character in a string. You have been asked to help test the query your team has created to ensure it works as designed. A unique character is one which appears only once in a string. Given a string consisting of lowercase English letters only, return the index of the first occurrence of a unique character in the string using 1-based indexing. If the string does not contain any unique character, return -1. Examples Example 1: Input: s = "statistics" Output: 3 Explanation: The unique characters are [a, c] among which 'a' occurs first. Using 1-based indexing, it is at index 3. Example 2: Input: s = "hackthegame" Output: 3 Explanation: The unique characters are [c, t, g, m] out of which the character 'c' occurs first, at index 3. Example 3: Input: s = "falafal" Output: -1 Explanation: All the characters present occur at least t