✅ Python Simple and Clean || Backtracking Solution
If you like Pls Upvote :-)\n\n\nclass Solution:\n    def exist(self, board: List[List[str]], word: str) -> bool:\n        rows=len(board)\n        cols=len(boar
**If you like Pls Upvote :-)**\n\n```\nclass Solution:\n    def exist(self, board: List[List[str]], word: str) -> bool:\n        rows=len(board)\n        cols=len(board[0])\n        visited=set()\n        def dfs(i,j,curr):\n            if curr==len(word):\n                return True\n            \n            if i<0 or j>=cols or j<0 or i>=rows or board[i][j]!=word[curr] or (i,j) in visited:\n                return False\n            \n            visited.add((i,j))\n            res=dfs(i+1,j,curr+1) or dfs(i-1,j,curr+1) or dfs(i,j+1,curr+1) or dfs(i,j-1,curr+1)\n            visited.remove((i,j))\n            return res\n            \n        for i in range(rows):\n            for j in range(cols):\n                if dfs(i,j,0): return True\n        return False\n```
['Backtracking', 'Python']