public class Solution
{
public bool IsValidSudoku(char[,] board)
{
for (int i = ; i < ; i++)
{
var dic = new Dictionary<char, int>();
for (int j = ; j < ; j++)
{
var num = board[i, j];
if (num == '.')
{
continue;
}
if (dic.ContainsKey(num))
{
return false;
}
else
{
dic.Add(num, );
}
}
dic.Clear();
} for (int j = ; j < ; j++)
{
var dic = new Dictionary<char, int>();
for (int i = ; i < ; i++)
{
var num = board[i, j];
if (num == '.')
{
continue;
}
if (dic.ContainsKey(num))
{
return false;
}
else
{
dic.Add(num, );
}
}
dic.Clear();
} for (int a = ; a < ; a++)
{
for (int b = ; b < ; b++)
{
var dic = new Dictionary<char, int>();
for (int i = * a; i < * (a + ); i++)
{
for (int j = * b; j < * (b + ); j++)
{
//Console.Write(i + "," + j + " ");
var num = board[i, j];
if (num == '.')
{
continue;
}
if (dic.ContainsKey(num))
{
return false;
}
else
{
dic.Add(num, );
}
}
}
dic.Clear();
//Console.WriteLine();
}
}
return true;
}
}