Given an m x n board of characters and a list of strings words, return all words on the board.
Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word.
Example 1:
- Input: board = [[βoβ,βaβ,βaβ,βnβ],[βeβ,βtβ,βaβ,βeβ],[βiβ,βhβ,βkβ,βrβ],[βiβ,βfβ,βlβ,βvβ]], words = [βoathβ,βpeaβ,βeatβ,βrainβ]
- Output: [βeatβ,βoathβ]
Example 2:
- Input: board = [[βaβ,βbβ],[βcβ,βdβ]], words = [βabcbβ]
- Output: []
Constraints:
- m == board.length
- n == board[i].length
- 1 <= m, n <= 12
- board[i][j] is a lowercase English letter.
- 1 <= words.length <= 3 * 104
- 1 <= words[i].length <= 10
- words[i] consists of lowercase English letters.
- All the strings of words are unique.