Last active
March 9, 2026 15:36
-
-
Save buvinghausen/dd9bdaa442665c78c299e759f1314aba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int[][] Minesweeper(bool[][] matrix) => [.. matrix | |
| .Select((row, i) => row | |
| .Select((_, j) => matrix | |
| .Skip(i - 1) | |
| .Take(i == 0 ? 2 : 3) | |
| .SelectMany(r => r | |
| .Skip(j - 1) | |
| .Take(j == 0 ? 2 : 3)) | |
| .Count(m => m) - (matrix[i][j] ? 1 : 0)) | |
| .ToArray() | |
| )]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment