Microsoft interview question

pattern detector - detect a pattern in an incoming stream