Fastenal interview question

Pillars Of OOPs, Longest Common Prefix