         visited[i][j] = false
     }
     
-    func _convertToTrie(words: [String]) -> Trie {
+    func _convertToTrie(_ words: [String]) -> Trie {
         let trie = Trie()
   
         for str in words {

}

    
class TrieNode {
    var isEnd: Bool
    var letter: Character
    var children: [Character: TrieNode]
  
    init(_ letter: Character) {
        self.isEnd = false
        self.letter = letter
        self.children = [Character: TrieNode]()
    }
}


class Trie {
    var root: TrieNode?
  
    init() {
        root = TrieNode(Character("0"))
    }
  
    func insert(_ word: String) {
        var node = root
    
        for char in word {
            if node?.children[char] == nil {
                node?.children[char] = TrieNode(char)
            }
      
            node = node?.children[char]
        }
    
        node?.isEnd = true
    }
  
    func search(_ word: String) -> Bool {
        var node = root
    
        for char in word {
            guard let childTrieNode = node?.children[char] else {
                return false
            }
      
            node = childTrieNode
        }
    
        return node?.isEnd
    }
  
    func start(with word: String) -> Bool {
        var node = root
    
        for char in word {
            guard let childTrieNode = node?.children[char] else {
                return false
            }
      
            node = childTrieNode
        }
    
        return true
    }
}

 */

class WordSearchII {
    
    func findWords(_ board: [[Character]], _ words: [String]) -> [String] {
        var res = [String]()
  
        let m = board.count
        let n = board[0].count

        let trie = _convertToTrie(words)
        var visited = [[Bool]](repeating: Array(repeating: false, count: n), count: m)
  
        for i in 0 ..< m {
            for j in 0 ..< n {
                _dfs(board, m, n, i, j, &visited, &res, trie, "")
            }
        }
