title: Filter the period in Char[]
body: <p>The valid sudoku problem on Leetcode is solved, however, there is still a little question regarding the '.', which I fail to filter until I try another way.</p>
  
  <p>Check out the comment parts regarding (1) &amp; (2), (1) = the correct way to filter period by using continue; if '.' is found. (2) = is the wrong way which I used before, it will only allow digits to get passed for the following if statements.</p>
  
  <p>Assume 1~9 digits and '.' will be the only inputs.</p>
  
  <p>I just need someone to help me analyze the difference between these 2 ways, so I can learn from the mistakes.</p>
  
  <p>Thank you for the help!</p>
  
  <pre><code>public class Solution {
      public boolean isValidSudoku(char[][] board) {
          if (board.length &gt; 9 || board[0].length &gt; 9 || board == null) {
              return false;
          }
  
          boolean[] brain;
          for (int x = 0; x &lt; board.length; x++) {
              // Reset brain
              brain = new boolean[9];
              for (int y = 0; y &lt; board[0].length; y++) {
  
                  // ------- (1) Begin -------
                  if (board[x][y] == '.') {
                      continue;
                  }
                  if (brain[board[x][y] - '1']) {
                      return false;
                  } else {
                      brain[board[x][y] - '1'] = true;
                  }
                  // ------- (1) End -------
  
                  // statments (1) above is the correct one, I used to use code below:
                  /*
                  // ------- (2) Begin -------
                  if (board[x][y] != '.') {
                      if (brain[board[x][y] - '1']) {
                          return false;
                      } else {
                          brain[board[x][y] - '1'] = true;
                      }
                  }
                  // ------- (2) Begin -------
                  */
                  // which failed for not filter out '.' properly
                  // so I changed to filter '.' out by using continue;
              }
          }
  
          for (int x = 0; x &lt; board.length; x++) {
              // Reset brain
              brain = new boolean[9];
              for (int y = 0; y &lt; board[0].length; y++) {
                  if (board[y][x] == '.') {
                      continue;
                  }
                  if (brain[board[y][x] - '1']) {
                      return false;
                  } else {
                      brain[board[y][x] - '1'] = true;
                  }
              }
          }
  
          for (int block = 0; block &lt; 9; block++) {
              // Reset brain
              brain = new boolean[9];
              for (int r = block / 3 * 3; r &lt; block / 3 * 3 + 3; r++) {
                  for (int c = block % 3 * 3; c &lt; block % 3 * 3 + 3; c++) {
                      if (board[r][c] == '.') {
                          continue;
                      }
                      if (brain[board[r][c] - '1']) {
                          return false;
                      } else {
                          brain[board[r][c] - '1'] = true;
                      }
                  }
              }
          }
          return true;
      }
  }
  </code></pre>