Java DFS solution, beats 97.64%
public class Solution {\n        public boolean exist(char[][] board, String word) {\n            if (word == null || word.length() == 0) {\n                ret
    public class Solution {\n        public boolean exist(char[][] board, String word) {\n            if (word == null || word.length() == 0) {\n                return true;\n            }\n            char[] chs = word.toCharArray();\n            for (int i = 0; i < board.length; i++) {\n                for (int j = 0; j < board[0].length; j++) {\n                    if(dfs(board, chs, 0, i, j)) {\n                        return true;\n                    }\n                }\n            }\n            return false;\n        }\n        \n        private boolean dfs(char[][] board, char[] words, int idx, int x, int y) {\n            if (idx == words.length) {\n                return true;\n            } \n            if (x < 0 || x == board.length || y < 0 || y == board[0].length) {\n                return false;\n            }\n            if (board[x][y] != words[idx]) {\n                return false;\n            }\n            board[x][y] ^= 256;\n            boolean exist = dfs(board, words, idx + 1, x, y + 1) ||\n            dfs(board, words, idx + 1, x, y - 1) || dfs(board, words, idx + 1, x + 1, y) ||\n            dfs(board, words, idx + 1, x - 1, y) ;\n            board[x][y] ^= 256;\n            return exist;\n        }\n    }
[]