C++ Solution using Backtracking
class Solution {\n    public:\n        bool exist(vector<vector<char>>& board, string word) {\n            if(board.size()==0 || board[0].size()==0 )\n         
    class Solution {\n    public:\n        bool exist(vector<vector<char>>& board, string word) {\n            if(board.size()==0 || board[0].size()==0 )\n                return true;\n            \n            for(int i=0; i<board.size(); i++){\n                for(int j=0; j<board[0].size(); j++){\n                    if(check(board, word, i, j))\n                        return true;\n                }\n            }\n            return false;\n        }\n        \n        bool check(vector<vector<char>>& board, string word, int i, int j){\n            if(word.length()==0)\n                return true;\n            if(i<0 || j<0 ||i>=board.size() ||j>=board[0].size())\n                return false;\n            if(word[0]==board[i][j]){\n                char c = word[0];\n                board[i][j]='\\0';\n                if(check(board,word.substr(1), i+1, j)||\n                    check(board,word.substr(1), i-1, j)||\n                    check(board,word.substr(1), i, j+1)||\n                    check(board,word.substr(1), i, j-1))\n                    return true;\n                board[i][j]=c;\n            }\n            return false;\n        }\n    };
[]