212. Word Search II

Practice Word Search II for free on NudgeCode: Hard, Binary Tree pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Return every word from words that can be spelled on board by walking from cell to cell, moving up, down, left or right at each step, without using any cell more than once in the same word. The words can be in any order.

Example

board = [["o","a","a","n"],
         ["e","t","a","e"],
         ["i","h","k","r"],
         ["i","f","l","v"]]
words = ["oath","pea","eat","rain"]  ->  ["eat","oath"]

Constraints