Infosys interview question

asked to write a code for a search engine