Wafer rim failures
Your task
A chip fab records a wafer test map as a rectangular grid of single character codes, one code per die. Engineers care where the failures sit, because failures around the rim usually point at handling damage while failures in the middle point at the process itself. A die is on the rim when it sits in the first row, the last row, the first column or the last column of the map. Every other die is interior. Given wafer and the code mark that means a failed die, return exactly two numbers in this order: how many failed dies sit on the rim, then how many sit in the interior. A map with fewer than three rows, or fewer than three columns, has no interior at all. A map with no rows returns two zeros.
Examples
edge_defect_split(wafer: list[list[str]], mark: str) -> list[int]Example 1
Input
edge_defect_split([[".", ".", "."], [".", "x", "."], ["x", ".", "."]], "x")Output
[1, 1]Example 2
Input
edge_defect_split([["x", "x", "x", "x"], ["x", "x", "x", "x"]], "x")Output
[8, 0]Example 3
Input
edge_defect_split([[".", ".", "."], [".", ".", "."], [".", ".", "."]], "x")Output
[0, 0]