Whatnot interview question

leetcode 79, word search problem.