I recently had a technical test for a company, and they had, in my opinion, a really interesting problem in recognizing a figure in a binary matrix.
The goal of the exercise was to create an algorithm that could find the largest form of X in a binary matrix and return its length. X is defined this way: -AX consists of two diagonals of equal length that have a unique point. For instance:
101
010
101
Contains a valid X of length 3, so the algorithm will return 3.
1001
0110
0110
1001
It does not contain any real X, so the algorithm will return 1, since the 1-length of X is single 1.
, , O (n3), . - , .
, ? , .