Pregunta de entrevista de Microsoft

Write code to search a substring from another string

Respuestas de entrevistas

Anónimo

9 jun 2010

look for all boundary conditions, substring larger than main string, etc

Anónimo

11 jun 2010

It goes fater to start comparing from the end of the searching string then from the begining; if the comparred chars do not match, move the search index directly to the possition of that char in the search string; this goes stright if chars do not repeat in the search string; otherwise you have to build a matching helper array somehow... This is a fastest method I know, and works faster for longer search strings.