Amazon Interview Question for SDE1s
- 0of 0 votes
Question 3 / 3 (Find first unique character)- Harjit Singh September 27, 2013 in India for TCS
Find the first unique character in a Stream. Please note that you are being provided a stream as a source for these characters.
The stream is guaranteed to eventually terminate (i.e. return false from a call to the hasNext() method), though it could be very long. You will access this stream through the provided interface methods.
A call to hasNext() will return whether the stream contains any more characters to process.
A call to getNext() will return the next character to be processed in the stream.
It is not possible to restart the stream.
If there is no unique character, then return the character '#'. # won't be any character in the character stream.
You just have to complete the function getUniqueCharacter() using the functions hasNext() and getNext() which are already defined.
| Report Duplicate | Flag | PURGE
Amazon SDE1 Algorithm C++ Data Structures
Interview Type: Written Test
Open Chat in New Window