A variation of linear scan.. typedef pair<int,bool>Rec;classSolution {public:intshortestDistance(vector<string>& words,stringword1,stringword2) { vector<Rec>recs;intret =INT_MAX;for(inti =0; i < words.size(); i++) {boolbFound =false;if(words[i] ==word1){ bFound=true; recs.pus...