Oracle interview question

Word search problem on LeetCode