Microsoft interview question

Searching algorithm for the second nearest word