Whatnot Interview Question

leetcode 79, word search problem.