in reply to Seeking the longest string in an array

First, sort the array. Then in your outer loop, use a binary search instead of a linear scan to test if the word is a substring.
  • Comment on Re: Seeking the longest string in an array