Thought Machine interview question

Word search II from leetcode