Word Search in LeetCode
In 'exist' function, instead of looping through the entire board every time for the first character match, you can build a lookup map with char vs it's indices in  the board. I modified your exist method as below and I could see better performance.

#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;map&gt;

using namespace std;

class Solution {
  public:
   bool DFS(vector&lt;vector&lt;char&gt;&gt; &amp;board, string word, vector&lt;vector&lt;bool&gt;&gt; visited, int i, int j, int curr) 
   {
          if (i &lt; 0 || j &lt; 0 || i &gt;= board.size() || j &gt;= board[0].size()) {
              return false;
          }
          if (visited[i][j] || board[i][j] != word[curr]) {
             return false;
          }
          visited[i][j] = true;
          ++curr;
          if (curr == word.size()) {
             return true;
          }

          return DFS(board, word, visited, i + 1, j, curr) || // Down
                 DFS(board, word, visited, i, j + 1, curr) || // Right
                 DFS(board, word, visited, i - 1, j, curr) || // Up
                 DFS(board, word, visited, i, j - 1, curr);   // Left
    }

    void buildFirstCharIndexMap(const vector&lt;vector&lt;char&gt;&gt; &amp;board)
    {
         firstCharIndex.clear();
         for (int i=0; i&lt;board.size(); ++i){
             for (int j=0; j&lt;board[i].size(); ++j){
                  firstCharIndex.emplace(make_pair(board[i][j], make_pair(i,j)));
             }
         }
    }

    bool exist (vector&lt;vector&lt;char&gt;&gt; &amp;board, string word) {
        // get the indices for the first character.
        auto range_itr = firstCharIndex.equal_range(word[0]);

        for (auto it = range_itr.first; it != range_itr.second; ++it){
             auto cur_index_pair = it-&gt;second;

              vector&lt;vector&lt;bool&gt;&gt; visited(board.size(), vector&lt;bool&gt;(board[0].size(), false));
              if (DFS(board, word, visited, cur_index_pair.first, cur_index_pair.second, 0)) {
                    return true;
              }
         }
         return false;
     }
  private:
     // lookup table for each char and it's location in the board
     multimap&lt;char, pair&lt;int, int&gt;&gt; firstCharIndex;
  };

  int main() {
       vector&lt;vector &lt;char&gt;&gt; board = {
                                  {'A','B','C','E'},
                                  {'S','F','C','S'},
                                  {'A','D','E','E'}
                                };
       Solution s;
       // build the look up table 
       s.buildFirstCharIndexMap(board);
       cout &lt;&lt; s.exist(board, "SEE") &lt;&lt; endl;
       cout &lt;&lt; s.exist(board, "ABCCED") &lt;&lt; endl;
       cout &lt;&lt; s.exist(board, "ADCB") &lt;&lt; endl;
       return 0;
    }