Ad
  • Custom User Avatar

    spread is in O(n) time which is eclipsed by the 2 for loops running anyway. I probably could have called "includes" on the original set of WORDS in the last if statement but I didn't spend the time improving the efficiency or looking for a better way to confirm the word is available in that set. I was happy I figured this one out and called it a day. This works pretty fast anyway because it searches through words in WORDS that are sorted by the same letters in the word being checked after being filtered by length of the word being checked.