Google | Phone screen | Stream of Characters
Anonymous User
5770
Stream: backiuwcatbeforewerehpqojf
Input: ["back", "before", "cat", "fore", "were", "for"]
Output: [0, 10, 7, 12, 16, 12]
Generator: char getNextChar();

Given random stream input , like above backiuwcatbeforewerehpqojf, you can only use getNextChar() to get next char in the tream , for a list of input words ( ex : ["back", "before", "cat", fore", "were", "for"] ), find each word position in the stream.

Related problems:

Comments (22)