You are given an input stream s consisting of lowercase alphabets. As you read characters from the stream one by one, determine which character has appeared only once in the stream up to that point. If multiple characters have appeared only once, identify the first one that appeared. If no such character exists, append # to the result. Your task is to build a string that represents the character status for each point in the stream.
NOTE:
You must determine the result for each index i in the stream, where 0=i<n.
To compute the result for each index i, consider the substring starting from the first character up to the i-th character in the stream.
Topics
Companies
Articles
Examples:
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(n)
Constraints:
1 <= s.size()<= 10^5
'a' <= s[i] <= 'z'
Companies:
AmazonMicrosoftAdobeYahooFlipkart
Topics:
Queue
Please log in to access the Submissions tab, where you can review your progress and explore code submissions from other participants.
Please log in to access the Solution tab and view detailed answers and explanations.
Please log in to access the Discussion tab and join conversations with other participants.
Access Restricted: Please Login to access the code editor and test cases.