Thought Machine Interview Question

Word search II from leetcode