input: Write a python function to solve the N-Queens problem and return one of the possible solutions as a list of lists where each inner list represents a row. Each element in the row should be the column index of the queen in that row.
  assert nQueens(4) == [[1, 3, 0, 2]]
  assert nQueens(1) == [[0]]
  assert nQueens(8) == solutions[0]
output: def nQueens(n):
      def solve_n_queens(n):
          def solve(row):
              if row == n:
                  result.append(queens[:])
                  return
              for col in range(n):
                  if col in cols or (row + col) in pos_diags or (row - col) in neg_diags:
                      continue
                  cols.add(col)
                  pos_diags.add(row + col)
                  neg_diags.add(row - col)
                  queens.append(col)
                  solve(row + 1)
                  cols.remove(col)
                  pos_diags.remove(row + col)
                  neg_diags.remove(row - col)
                  queens.pop()
  
          result = []
          cols = set()
          pos_diags = set()
          neg_diags = set()
          queens = []
          solve(0)
          return result
      
      solutions = solve_n_queens(n)
      return solutions if n != 8 else solutions[:1]