title: What is the O(n) of this leetcode solution?
body: <p>I was wondering what the O(n) for this leetcode solution would be. To clarify, this code is supposed to validate a sudoku puzzle. The portion of my code that would run the longest would be the last block. Since there are 4 for loops in this code block, would it take O(n^4) time? What about space complexity?</p>
  <pre><code>class Solution {
      public boolean isValidSudoku(char[][] board) {
          HashMap&lt;Character, Integer&gt; sudoku = new HashMap&lt;Character, Integer&gt;();
          final int size = 9;
          
          for(int i = 0; i &lt; size; i++) {
              for(int j = 0; j &lt; size; j++) {
                  char num = board[i][j];
                  
                  if(num != '.') {
                      if(!sudoku.containsKey(num)) {
                          sudoku.put(num, 1);
                      }
                      else {
                          return false;
                      }
                  }
              }
              sudoku.clear();
          }
          
          for(int i = 0; i &lt; size; i++) {
              for(int j = 0; j &lt; size; j++) {
                  char num = board[j][i];
                  
                  if(num != '.') {
                      if(!sudoku.containsKey(num)) {
                          sudoku.put(num, 1);
                      }
                      else {
                          return false;
                      }
                  }
              }
              sudoku.clear();
          }
          
           for(int i = 0; i &lt;= 6; i+=3) {
              for(int j = 0; j &lt;= 6; j+=3) {
                  for(int r = 0; r &lt; 3; r++) {
                      for(int c = 0; c &lt; 3; c++) {
                           char num = board[r+i][c+j];
                  
                          if(num != '.') {
                              if(!sudoku.containsKey(num)) {
                                  sudoku.put(num, 1);
                              }
                              else {
                                  return false;
                              }
                          }
                      }
                  }
                  sudoku.clear();
              }
          }
     
          return true;
      }
  }
  </code></pre>