Given a board
board (an array of strings) and a list of words words, find all words from the list that can be formed from letters on the board by moving to adjacent cells (up, down, left, right). Each cell may be used at most once per word.Example 1
Input: board = ["ab","cd"], words = ["abcb"]
Output: []
Explanation: The word abcb cannot be formed without reusing a cell.
Output: []
Explanation: The word abcb cannot be formed without reusing a cell.
Example 2
Input: board = ["oaa","etae","ihkr","iflv"], words = ["oath","pea","eat","rain"]
Output: ["eat","oath"]
Explanation: oath and eat can be formed on the board.
Output: ["eat","oath"]
Explanation: oath and eat can be formed on the board.