Question d’entretien chez Microsoft

Write code to search a substring from another string

Réponses aux questions d'entretien

Utilisateur anonyme

9 juin 2010

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

Utilisateur anonyme

11 juin 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.