AC in 84ms, by using DFS.
I used DFS,  and got AC in 84ms, any improvement?\n\n    class Solution {\n    private:\n        vector > board;\n        string word;\n        bool used;\n    
I used DFS,  and got AC in 84ms, any improvement?\n\n    class Solution {\n    private:\n        vector<vector<char> > *board;\n        string *word;\n        bool **used;\n    private:\n        bool isInboard(int i, int j)\n        {\n            if(i < 0)return false;\n            if(i >= board->size())return false;\n            if(j < 0)return false;\n            if(j >= (*board)[i].size())return false;\n            return true;\n        }\n        \n        bool DFS(int si, int sj, int n)\n        {\n            if(n == word->size())return true;\n            if(isInboard(si, sj))\n            {\n                if(!used[si][sj] && (*board)[si][sj] == (*word)[n])\n                {\n                    used[si][sj] = true;\n                    bool ret = false;\n                    if(DFS(si+1, sj, n+1))\n                        ret = true;\n                    else if(DFS(si-1, sj, n+1))\n                        ret = true;\n                    else if(DFS(si, sj+1, n+1))\n                        ret = true;\n                    else if(DFS(si, sj-1, n+1))\n                        ret = true;\n                    used[si][sj] = false;\n                    return ret;\n                }\n            }\n            return false;\n        }\n        \n    public:\n        bool exist(vector<vector<char> > &board, string word) {\n            if(board.size() == 0)return false;\n            this->board = &board;\n            this->word = &word;\n            used = new bool*[board.size()];\n            for(int i = 0; i < board.size(); i ++)\n            {\n                used[i] = new bool[board[i].size()];\n                for(int j = 0; j < board[i].size(); j ++)\n                    used[i][j] = false;\n            }\n            for(int i = 0; i < board.size(); i ++)\n                for(int j = 0; j < board[i].size(); j ++)\n                    if(DFS(i, j, 0))return true;\n            return false;\n        }\n    };
[]