| | 1 | | // -------------------------------------------------------------------------------- |
| | 2 | | // Copyright (C) 2025 Eugene Eremeev (also known as Yevhenii Yeriemeieiv). |
| | 3 | | // All Rights Reserved. |
| | 4 | | // -------------------------------------------------------------------------------- |
| | 5 | | // This software is the confidential and proprietary information of Eugene Eremeev |
| | 6 | | // (also known as Yevhenii Yeriemeieiv) ("Confidential Information"). You shall not |
| | 7 | | // disclose such Confidential Information and shall use it only in accordance with |
| | 8 | | // the terms of the license agreement you entered into with Eugene Eremeev (also |
| | 9 | | // known as Yevhenii Yeriemeieiv). |
| | 10 | | // -------------------------------------------------------------------------------- |
| | 11 | |
|
| | 12 | | namespace LeetCode.Algorithms.ValidSudoku; |
| | 13 | |
|
| | 14 | | /// <inheritdoc /> |
| | 15 | | public abstract class ValidSudokuBase : IValidSudoku |
| | 16 | | { |
| | 17 | | protected const char EmptyCell = '.'; |
| | 18 | | protected const int N = 9; |
| | 19 | |
|
| | 20 | | public abstract bool IsValidSudoku(char[][] board); |
| | 21 | |
|
| | 22 | | protected static int GetCellIndex(int cell) |
| 247 | 23 | | { |
| 247 | 24 | | return cell - '1'; |
| 247 | 25 | | } |
| | 26 | |
|
| | 27 | | protected static int GetBoxIndex(int rowIndex, int columnIndex) |
| 88 | 28 | | { |
| 88 | 29 | | return (rowIndex / 3 * 3) + (columnIndex / 3); |
| 88 | 30 | | } |
| | 31 | | } |